public bool Register(MemberActionView model) { try { Member member = new Member(); member.Account = model.Account; member.AccumulatedPoints = 0; member.Address = model.Address; member.BirthDay = model.BirthDay; member.DateJoin = DateTime.Now; member.Gender = model.Gender; member.Mail = model.Mail; member.Name = model.Name; member.Password = model.Password; member.Phone = model.Phone; member.Platform = "Web"; member.Status = true; DbContext.Members.Add(member); return(true); } catch (System.Exception) { return(false); } }
public MemberActionView GetEdit(int id) { try { var _item = DbContext.Members.Find(id); if (_item != null && _item.ID != 0) { MemberActionView member = new MemberActionView(); member.Account = _item.Account; member.Address = _item.Address; member.BirthDay = _item.BirthDay; member.Gender = _item.Gender; member.ID = _item.ID; member.Mail = _item.Mail; member.Name = _item.Name; member.Phone = _item.Phone; return(member); } return(null); } catch (System.Exception) { return(null); } }
public bool ChangeInfo(MemberActionView model) { try { var _item = DbContext.Members.Find(model.ID); if (_item != null && _item.ID != 0) { _item.Mail = model.Mail; _item.Name = model.Name; _item.Phone = model.Phone; _item.Address = model.Address; _item.BirthDay = model.BirthDay; _item.Gender = model.Gender; return(true); } return(false); } catch (Exception) { return(false); } }
public ActionResult InfoChange(MemberActionView model) { try { if (ModelState.IsValid) { if (_memberBusiness.CheckExistsAccount(model.Account, model.ID)) { ModelState.AddModelError("ExistsAccountError", "Tài khoản này đã tồn tại trong hệ thống"); } if (_memberBusiness.ChangeInfo(model)) { _memberBusiness.Save(); return(Redirect("/thong-tin-tai-khoan.html")); } } return(View(model)); } catch (Exception) { return(View(model)); } }
public ActionResult Register(MemberActionView model) { try { if (ModelState.IsValid) { if (_memberBusiness.CheckExistsAccount(model.Account, 0)) { ModelState.AddModelError("ExistsAccountError", "Tài khoản này đã tồn tại trong hệ thống"); } if (_memberBusiness.Register(model)) { _memberBusiness.Save(); return(Redirect("/dang-nhap.html")); } } return(View(model)); } catch (Exception) { return(View(model)); } }
public bool Register(MemberActionView model) { return(_member.Register(model)); }
public bool ChangeInfo(MemberActionView model) { return(_member.ChangeInfo(model)); }