コード例 #1
0
 public OverTimeProxy GetItem(decimal id)
 {
     try
     {
         var           overTimeDetail = OverTimeDetailBusiness.GetByID(id);
         OverTimeProxy overTimeProxy  = OverTimeDetailBusiness.ConvertToProxy(overTimeDetail);
         return(overTimeProxy);
     }
     catch (Exception ex)
     {
         this.exceptionHandler.ApiHandleException("OverTimeController", ex);
         throw ex;
     }
 }
コード例 #2
0
        public HttpResponseMessage Edit(decimal id, OverTimeProxy viewModel)
        {
            try
            {
                OverTimeDetail model = OverTimeDetailBusiness.GetByID(id);

                model.MaxHoliday  = viewModel.MaxHoliday;
                model.MaxNightly  = viewModel.MaxNightly;
                model.MaxOverTime = viewModel.MaxOverTime;

                OverTimeDetailBusiness.UpdateOverTimeDetail(model);
                return(Request.CreateResponse(HttpStatusCode.OK, viewModel));
            }
            catch (UIValidationExceptions ex)
            {
                this.exceptionHandler.ApiHandleException("OverTimeController", ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.ExceptionList.Count > 0 ? ex.ExceptionList[0].Message : ex.Message));
            }
            catch (Exception ex)
            {
                this.exceptionHandler.ApiHandleException("OverTimeController", ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }