コード例 #1
0
 public HttpResponseMessage DeleteEducationalHistory(EducationalHistoryModel model)
 {
     try
     {
         if (this.ModelState.IsValid)
         {
             var result = _educationalHistoryService.DeleteEducationalHistory(model);
             if (result != null)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, result));
             }
             else
             {
                 string message = "Not deleted successfully";
                 return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
             }
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
     }
 }
コード例 #2
0
 public HttpResponseMessage GetEducationalHistoryModels(EducationalHistoryModel model)
 {
     try
     {
         if (this.ModelState.IsValid)
         {
             var EducationalHistoryList = _educationalHistoryService.GetAllEducationalHistoryList(model);
             if (EducationalHistoryList != null)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, EducationalHistoryList));
             }
             else
             {
                 string message = "Error in getting Data";
                 return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
             }
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message));
     }
 }