Ejemplo n.º 1
0
        public ResponseObject <bool> CreateServiceITSupport(ServiceITSupportAPIViewModel model)
        {
            var serviceITSupportRepo   = DependencyUtils.Resolve <IServiceITSupportRepository>();
            var createServiceitsupport = new ServiceITSupport();

            try
            {
                createServiceitsupport.ServiceITSupportId = model.ServiceITSupportId;
                createServiceitsupport.ServiceName        = model.ServiceName;
                createServiceitsupport.Description        = model.Description;
                createServiceitsupport.IsDelete           = false;
                createServiceitsupport.CreateDate         = DateTime.UtcNow.AddHours(7);
                createServiceitsupport.UpdateDate         = DateTime.UtcNow.AddHours(7);

                serviceITSupportRepo.Add(createServiceitsupport);

                serviceITSupportRepo.Save();
                return(new ResponseObject <bool> {
                    IsError = false, SuccessMessage = "Thêm loại dịch vụ thành công", ObjReturn = true
                });
            }
            catch (Exception ex)
            {
                return(new ResponseObject <bool> {
                    IsError = true, WarningMessage = "Thêm loại dịch vụ thất bại", ErrorMessage = ex.ToString(), ObjReturn = false
                });
            }
        }
        public ResponseObject <bool> UpdateServiceITSupport(ServiceITSupportAPIViewModel model)
        {
            var serviceITSupportService = this.Service <IServiceITSupportService>();

            var result = serviceITSupportService.UpdateServiceITSupport(model);

            return(result);
        }
Ejemplo n.º 3
0
        public ResponseObject <bool> UpdateServiceITSupport(ServiceITSupportAPIViewModel model)
        {
            var serviceITSupportRepo   = DependencyUtils.Resolve <IServiceITSupportRepository>();
            var updateServiceitsupport = serviceITSupportRepo.GetActive().SingleOrDefault(a => a.ServiceITSupportId == model.ServiceITSupportId);

            if (updateServiceitsupport != null)
            {
                updateServiceitsupport.ServiceName = model.ServiceName;
                updateServiceitsupport.Description = model.Description;
                updateServiceitsupport.UpdateDate  = DateTime.UtcNow.AddHours(7);

                serviceITSupportRepo.Edit(updateServiceitsupport);
                serviceITSupportRepo.Save();
                return(new ResponseObject <bool> {
                    IsError = false, SuccessMessage = "Chỉnh sửa loại dịch vụ thành công", ObjReturn = true
                });
            }

            return(new ResponseObject <bool> {
                IsError = true, WarningMessage = "Chỉnh sửa loại dịch vụ thất bại", ObjReturn = false
            });
        }
Ejemplo n.º 4
0
        public ResponseObject <ServiceITSupportAPIViewModel> ViewDetail(int serviceitsupport_id)
        {
            var serviceITSupportRepo = DependencyUtils.Resolve <IServiceITSupportRepository>();
            var serviceitsupport     = serviceITSupportRepo.GetActive().SingleOrDefault(a => a.ServiceITSupportId == serviceitsupport_id);

            if (serviceitsupport != null)
            {
                var devicetypeAPIViewModel = new ServiceITSupportAPIViewModel
                {
                    ServiceITSupportId = serviceitsupport.ServiceITSupportId,
                    ServiceName        = serviceitsupport.ServiceName,
                    Description        = serviceitsupport.Description,
                    CreateDate         = serviceitsupport.CreateDate.ToString("dd/MM/yyyy"),
                    UpdateDate         = serviceitsupport.UpdateDate.Value.ToString("dd/MM/yyyy"),
                };
                return(new ResponseObject <ServiceITSupportAPIViewModel> {
                    IsError = false, ObjReturn = devicetypeAPIViewModel, SuccessMessage = "Lấy chi tiết thành công"
                });
            }
            return(new ResponseObject <ServiceITSupportAPIViewModel> {
                IsError = true, WarningMessage = "Không tồn tại loại dịch vụ bị này"
            });
        }
        public ActionResult UpdateServiceITSupport(ServiceITSupportAPIViewModel model)
        {
            var result = _serviceITSupportDomain.UpdateServiceITSupport(model);

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