Пример #1
0
 public ActionResult Create()
 {
     var m = new Ministry { MinistryName = "NEW" };
     DbUtil.Db.Ministries.InsertOnSubmit(m);
     DbUtil.Db.SubmitChanges();
     return Redirect($"/Ministry/#{m.MinistryId}");
 }
Пример #2
0
		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;
		}
Пример #3
0
        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);
        }