public BaseResponse <OwnDrugRecModel> SaveOwnDrugRec(OwnDrugRecModel request) { var ownDrugRec = unitOfWork.GetRepository <LTC_OWNDRUGREC>().dbSet.Where(m => m.OWNDRUGID == request.OwnDrugId).FirstOrDefault(); if (ownDrugRec != null) { request.OwnDrugId = ownDrugRec.OWNDRUGID; request.FeeNo = ownDrugRec.FEENO; request.OrgId = ownDrugRec.ORGID; request.Reason = request.Reason; request.SponsorName = request.SponsorName; request.OpertorName = request.OpertorName; request.OpertorTime = request.OpertorTime; request.CreateBy = ownDrugRec.CREATEBY; request.CreateTime = ownDrugRec.CREATETIME; request.IsDelete = ownDrugRec.ISDELETE; request.UpdateBy = SecurityHelper.CurrentPrincipal.EmpNo; request.UpdateTime = DateTime.Now; return(base.Save <LTC_OWNDRUGREC, OwnDrugRecModel>(request, (q) => q.OWNDRUGID == request.OwnDrugId)); } else { request.OrgId = SecurityHelper.CurrentPrincipal.OrgId; request.CreateBy = SecurityHelper.CurrentPrincipal.EmpNo; request.CreateTime = DateTime.Now; request.IsDelete = false; return(base.Save <LTC_OWNDRUGREC, OwnDrugRecModel>(request, (q) => q.OWNDRUGID == request.OwnDrugId)); } }
public IHttpActionResult Save(OwnDrugRecModel baseRequest) { var response = service.SaveOwnDrugRec(baseRequest); return(Ok(response)); }