예제 #1
0
 public ActionResult Create(int? id)
 {
     if (!id.HasValue)
         return Content("need an integer id");
     var m = new MemberType { Id = id.Value };
     DbUtil.Db.MemberTypes.InsertOnSubmit(m);
     DbUtil.Db.SubmitChanges();
     return Redirect("/MemberType/");
 }
예제 #2
0
        public ActionResult Create(int? id)
        {
            if (!id.HasValue)
                return Content("need an integer id");

            if (!DbUtil.Db.MemberTypes.Any(mt => mt.Id == id))
            {
                var m = new MemberType {Id = id.Value};
                DbUtil.Db.MemberTypes.InsertOnSubmit(m);
                DbUtil.Db.SubmitChanges();
            }

            return Redirect($"/MemberType/#{id}");
        }
예제 #3
0
 public static MemberType FetchOrCreateMemberType(CMSDataContext Db, string type)
 {
     var mt = Db.MemberTypes.SingleOrDefault(pp => pp.Description == type);
     if (mt == null)
     {
         var max = Db.MemberTypes.Max(mm => mm.Id) + 10;
         if (max < 1000)
             max = 1010;
         mt = new MemberType { Id = max, Description = type, Code = type.Truncate(20), AttendanceTypeId = AttendTypeCode.Member };
         Db.MemberTypes.InsertOnSubmit(mt);
         Db.SubmitChanges();
     }
     return mt;
 }
예제 #4
0
		private void detach_MemberTypes(MemberType entity)
		{
			this.SendPropertyChanging();
			entity.AttendType = null;
		}
예제 #5
0
 private void detach_MemberTypes(MemberType entity)
 {
     this.SendPropertyChanging();
     entity.AttendType = null;
 }