public bool Update(long tid, ClientComments tentity) { var success = false; if (tentity != null && tid != 0) { using (var scope = new TransactionScope()) { var oldrecord = _unitOfWork.ClientCommentRepository.GetByID(tid); if (oldrecord != null) { oldrecord.cmntcontent = tentity.cmntcontent; oldrecord.cmntcreatedate = tentity.cmntcreatedate; oldrecord.cmntdate = tentity.cmntdate; oldrecord.cmntype = tentity.cmntype; oldrecord.userfkid = tentity.userfkid; _unitOfWork.ClientCommentRepository.Update(oldrecord); _unitOfWork.Save(); scope.Complete(); success = true; } } } return(success); }
public static ClientComments ClientCommentMapper(ta_ussbk_client_comment tentity) { var resultl = new ClientComments { cmntcontent = tentity.cmntcontent, cmntcreatedate = tentity.cmntcreatedate, cmntdate = tentity.cmntdate, cmntid = tentity.cmntid, cmntype = tentity.cmntype, userfkid = tentity.userfkid, }; return(resultl); }
public long Create(ClientComments tentity) { using (var scope = new TransactionScope()) { var NewRecord = new ta_ussbk_client_comment { cmntcontent = tentity.cmntcontent, cmntcreatedate = tentity.cmntcreatedate, cmntdate = tentity.cmntdate, cmntype = tentity.cmntype, userfkid = tentity.userfkid, }; _unitOfWork.ClientCommentRepository.Insert(NewRecord); _unitOfWork.Save(); scope.Complete(); return(NewRecord.cmntid); } }
public ActionResult Save(ClientComments input) { bool status = false; if (ModelState.IsValid) { if (input.cmntid > 0) { var result = _mainobj.Update(input.cmntid, input); } else { input.cmntcreatedate = DateTime.Now; input.userfkid = Convert.ToInt32(Session["clientuserid"]); var result = _mainobj.Create(input); } status = true; } return(new JsonResult { Data = new { status = status } }); }