[longomatch] Fix templates copy
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix templates copy
- Date: Tue, 2 Dec 2014 23:42:36 +0000 (UTC)
commit 96da61ee047a3cfa192068e1cb0c71c284e5f151
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Dec 3 00:36:44 2014 +0100
Fix templates copy
LongoMatch.Services/Services/TemplatesService.cs | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Services/Services/TemplatesService.cs
b/LongoMatch.Services/Services/TemplatesService.cs
index 41373cd..6823a04 100644
--- a/LongoMatch.Services/Services/TemplatesService.cs
+++ b/LongoMatch.Services/Services/TemplatesService.cs
@@ -178,6 +178,8 @@ namespace LongoMatch.Services
public void Copy (string orig, string copy)
{
+ T template;
+
if (File.Exists (copy)) {
throw new Exception (Catalog.GetString ("A template already exists with " +
"the name: ") + copy);
@@ -185,7 +187,15 @@ namespace LongoMatch.Services
CheckInvalidChars (copy);
Log.Information (String.Format ("Copying template {0} to {1}", orig, copy));
- File.Copy (GetPath (orig), GetPath (copy));
+
+ template = systemTemplates.FirstOrDefault (t => t.Name == orig);
+
+ if (template == null) {
+ template = Load (orig);
+ }
+ template.ID = new Guid ();
+ template.Name = copy;
+ Save (template);
}
public void Delete (string templateName)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]