public IHttpActionResult Post(VisitPrescription baseRequest) { baseRequest.OrgId = SecurityHelper.CurrentPrincipal.OrgId; var response = service.SaveVisitPreData(baseRequest); return(Ok(response)); }
public BaseResponse <IList <VisitPrescription> > QueryVisitPreData(BaseRequest <VisitPrescriptionFilter> request) { var response = new BaseResponse <IList <VisitPrescription> >(); var q = from vr in unitOfWork.GetRepository <LTC_VISITPRESCRIPTION>().dbSet join m in unitOfWork.GetRepository <LTC_MEDICINE>().dbSet on vr.MEDID equals m.MEDID into vr_m from vr_med in vr_m.DefaultIfEmpty() join freq in unitOfWork.GetRepository <LTC_DRGFREQREF>().dbSet on vr.FREQ equals freq.FREQNO into vr_m2 from vr_freq in vr_m2.DefaultIfEmpty() select new { visitPrescription = vr, EngName = vr_med.ENGNAME, ChnName = vr_med.CHNNAME, FreqName = vr_freq.FREQNAME, }; q = q.Where(m => m.visitPrescription.SEQNO == request.Data.SeqNo); q = q.OrderByDescending(m => m.visitPrescription.SEQNO); response.RecordsCount = q.Count(); Action <IList> mapperResponse = (IList list) => { response.Data = new List <VisitPrescription>(); foreach (dynamic item in list) { VisitPrescription newItem = Mapper.DynamicMap <VisitPrescription>(item.visitPrescription); newItem.EngName = item.EngName; newItem.ChnName = item.ChnName; newItem.FreqName = item.FreqName; response.Data.Add(newItem); } }; if (request != null && request.PageSize > 0) { var list = q.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize).ToList(); response.PagesCount = GetPagesCount(request.PageSize, response.RecordsCount); mapperResponse(list); } else { var list = q.ToList(); mapperResponse(list); } return(response); }
public BaseResponse <VisitPrescription> SaveVisitPreData(VisitPrescription request) { return(base.Save <LTC_VISITPRESCRIPTION, VisitPrescription>(request, (q) => q.PID == request.PId)); }
public BaseResponse <VisitPrescription> SaveVisitPreData(VisitPrescription request) { request.Operator = SecurityHelper.CurrentPrincipal.EmpNo; return(base.Save <LTC_VISITPRESCRIPTION, VisitPrescription>(request, (q) => q.PID == request.PId)); }