public ActionResult _ajaxSaveMember(Member member) { if (ModelState.IsValid) { try { //should be checking the result to validate the operation var m = _memberRepository.SaveMember(member); ViewBag.SuccessMessage = "Member Saved"; return PartialView("EditorTemplates/Member", m); } catch (Exception ex) { ViewBag.SuccessMessage = "There was a problem saving the record"; //log the exception and tell someone return PartialView("EditorTemplates/Member", member); } } else { return PartialView("EditorTemplates/Member", member); } }
public Member SaveMember(Member member) { var nm = _dataContext.Members.FirstOrDefault(e => e.MemberId == member.MemberId); if (nm == null) { nm = new Member(); nm.MemberId = _dataContext.Members.Count() + 1; _dataContext.Members.Add(nm); } nm.FirstName = member.FirstName; nm.LastName = member.LastName; nm.ContactNumber = member.ContactNumber; nm.MaxBorrowings = member.MaxBorrowings; return nm; }
/// <summary> /// save the member /// </summary> /// <param name="member">the member to be saved</param> /// <returns></returns> public Member SaveMember(Member member) { return _datacontext.SaveMember(member); }
public BorrowingModel(Member m, Publication publciation) { Member = m; Publication = publciation; }
public BorrowingModel(Member m, List<MemberCurrentBookBorrowing> currentBooks) { Member = m; MemberCurrentBookBorrowing = currentBooks; }
public BorrowingModel(Member member) { Member = member; }