コード例 #1
0
        public HttpResponseMessage UpdatePaymentRelease(AddUpdatePaymentReleaseDomainModel model)
        {
            HttpResponseMessage httpResponse = new HttpResponseMessage();

            try
            {
                var objRes = ProjectRepository.UpdatePaymentRelease(model);
                if (objRes == null)
                {
                    //respnose.isSuccess = false;
                    httpResponse = Request.CreateResponse(HttpStatusCode.InternalServerError, "Error Occurred");
                }
                else
                {
                    httpResponse = Request.CreateResponse(HttpStatusCode.OK, objRes);
                }
                return(httpResponse);
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = new StringContent("An error occurred, please try again or contact the administrator."),
                    ReasonPhrase = "An error occurred, please try again or contact the administrator.",
                    StatusCode   = HttpStatusCode.InternalServerError
                });
            }
        }
コード例 #2
0
 public ResponseDomainModel UpdatePaymentRelease(AddUpdatePaymentReleaseDomainModel model)
 {
     try
     {
         DateTime date     = DateTime.ParseExact(model.NextDueDate, "dd/MM/yyyy", null); // necessary so that it can catch error
         var      response = objHelper.Query <ResponseDomainModel>("AddUpdatePaymentRelease", new { PaymentId = model.PaymentId, ProjectId = model.ProjectId, ReleasedAmount = model.ReleasedAmount, NextDueDate = model.NextDueDate, CreatedBy = model.CreatedBy }).FirstOrDefault();
         return(response);
     }
     catch (Exception ex)
     {
         ErrorLog.LogError(ex);
         return(null);
     }
 }