public override bool CreateCustomView(Grid grid) { TemplateSimple ts = new TemplateSimple(); ts.HR1.Tag = 0; ts.HR2.Tag = 1; ts.HLRname.Tag = 2; ts.HLMod.Tag = 3; ts.HLCharname.Tag = 4; grid.Children.Add(ts); Grid.SetColumn(ts, 1); Grid.SetRow(ts, 1); return(true); }
public int CreateTemplate(TemplateSimple model) { var entity = new Template() { Name = model.Name }; using (var ctx = new ApplicationDbContext()) { ctx.Templates.Add(entity); if (ctx.SaveChanges() == 1) { return(entity.Id); } return(0); } }
public ActionResult Create(TemplateSimple model) { if (!ModelState.IsValid) { return(View(model)); } var service = new TemplateService(); int id = service.CreateTemplate(model); service.SeedNameProperty(id); if (id != 0) { TempData["SaveResult"] = "Add Properties."; return(RedirectToAction("Create", "TemplateProperty", new { templateId = id })); } ; ModelState.AddModelError("", "Template could not be created."); return(View(model)); }