public void Create_Location_Test() { TemplateDTO Locaiton = new TemplateDTO { Name = "A new Beginning?", Title = "A doom start", Story = "You wake up from a nasty new years eve", AreaId = 1, FotoUrl = "~/Image/Background" }; string result = TemplateLogic.CreateTemplate("Location", Locaiton); Assert.AreEqual("Insert succesfull", result); }
public ActionResult Create(IFormCollection collection) { try { TemplateDTO templateDTO = new TemplateDTO { AreaId = Convert.ToInt32(collection["AreaId"]), Name = collection["Name"], Title = collection["Title"], Story = collection["Story"], FotoUrl = collection["FotoUrl"] }; //Causes a issue due the fact that TemplateName is empty string result = TemplateLogic.CreateTemplate(TemplateName, templateDTO); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
private bool Save() { _template.TemplateName = txtName.Text; _template.PathMask = txtPathMask.Text; _template.FileMask = txtFileMask.Text; _template.CodeProjectTypeCode = cboProjType.SelectedValue.ToString().Length > 0 ? cboProjType.SelectedValue.ToString() : null; _template.LanguageTypeCode = cboLanguage.SelectedValue.ToString().Length > 0 ? cboLanguage.SelectedValue.ToString() : null; _template.DeletedEntities = Helpers.SyncList(_template.TemplateEntityAttributes, _attrList, (to, from) => to.EntityAttributeTypeCode == from.EntityAttributeTypeCode); var logic = new TemplateLogic(GlobalData.AppInfo); if (_template.TemplateId == 0) { logic.CreateTemplate(_template); } else { logic.UpdateTemplate(_template); } return(true); }