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);
     }
 }
Пример #2
0
        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;
        }
Пример #3
0
 /// <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);
 }
Пример #4
0
 public BorrowingModel(Member m, Publication publciation)
 {
     Member = m;
     Publication = publciation;
 }
Пример #5
0
 public BorrowingModel(Member m, List<MemberCurrentBookBorrowing> currentBooks)
 {
     Member = m;
     MemberCurrentBookBorrowing = currentBooks;
 }
Пример #6
0
 public BorrowingModel(Member member)
 {
     Member = member;
 }