public ActionResult Create() { var m = new Ministry { MinistryName = "NEW" }; DbUtil.Db.Ministries.InsertOnSubmit(m); DbUtil.Db.SubmitChanges(); return Redirect($"/Ministry/#{m.MinistryId}"); }
public static Ministry FetchOrCreateMinistry(CMSDataContext Db, string name) { var m = Db.Ministries.SingleOrDefault(pp => pp.MinistryName == name); if (m == null) { m = new Ministry { MinistryName = name }; Db.Ministries.InsertOnSubmit(m); Db.SubmitChanges(); } return m; }
public static Ministry FetchOrCreateMinistry(CMSDataContext Db, string name) { var m = Db.Ministries.SingleOrDefault(pp => pp.MinistryName == name); if (m == null) { m = new Ministry { MinistryName = name }; Db.Ministries.InsertOnSubmit(m); Db.SubmitChanges(); } return(m); }