public ResponseObject <bool> CreateGuideline(GuidelineAPIViewModel model)
        {
            var guidelineService = this.Service <IGuidelineService>();
            var rs = guidelineService.CreateGuideline(model);

            return(rs);
        }
예제 #2
0
 public ResponseObject <GuidelineAPIViewModel> ViewDetail(int guidelineId)
 {
     try
     {
         var guidelineRepo = DependencyUtils.Resolve <IGuidelineRepository>();
         var guideline     = guidelineRepo.GetActive().SingleOrDefault(a => a.GuidelineId == guidelineId);
         if (guideline != null)
         {
             var GuidelineAPIViewModel = new GuidelineAPIViewModel
             {
                 GuidelineName = guideline.GuidelineName,
                 GuidelineId   = guideline.GuidelineId,
                 CreateDate    = guideline.CreateDate.ToString("HH:mm dd/MM/yyyy"),
                 UpdateDate    = guideline.UpdateDate != null?guideline.UpdateDate.Value.ToString("HH:mm dd/MM/yyyy") : string.Empty
             };
             return(new ResponseObject <GuidelineAPIViewModel> {
                 IsError = false, ObjReturn = GuidelineAPIViewModel, SuccessMessage = "Lấy chi tiết thành công"
             });
         }
         return(new ResponseObject <GuidelineAPIViewModel> {
             IsError = true, WarningMessage = "Không tồn tại hướng dẫn này"
         });
     }
     catch (Exception e)
     {
         return(new ResponseObject <GuidelineAPIViewModel> {
             IsError = true, WarningMessage = "Không tồn tại hướng dẫn này", ObjReturn = null, ErrorMessage = e.ToString()
         });
     }
 }
예제 #3
0
        public ResponseObject <bool> CreateGuideline(GuidelineAPIViewModel model)
        {
            try
            {
                var guidelineRepo = DependencyUtils.Resolve <IGuidelineRepository>();
                var guideline     = new Guideline();

                guideline.ServiceItemId = model.ServiceItemId;
                guideline.GuidelineName = model.GuidelineName;
                guideline.CreateDate    = DateTime.UtcNow.AddHours(7);
                guideline.UpdateDate    = DateTime.UtcNow.AddHours(7);
                guidelineRepo.Add(guideline);
                guidelineRepo.Save();
                return(new ResponseObject <bool> {
                    IsError = false, SuccessMessage = "Tạo hướng dẫn thành công!", ObjReturn = true
                });
            }
            catch (Exception e)
            {
                return(new ResponseObject <bool> {
                    IsError = true, WarningMessage = "Xóa hướng dẫn thất bại!", ObjReturn = false, ErrorMessage = e.ToString()
                });
            }
        }
        public ActionResult CreateGuideline(GuidelineAPIViewModel model)
        {
            var result = _guidelineDomain.CreateGuideline(model);

            return(Json(new { result }, JsonRequestBehavior.AllowGet));
        }