예제 #1
0
        public HttpResponseMessage GetEducationModels(EducationModel model)
        {
            IUnitOfWork          uWork            = new UnitOfWork();
            IEducationRepository education        = new EducationRepository(uWork);
            IEducationService    educationService = new EducationService(education);

            try
            {
                if (this.ModelState.IsValid)
                {
                    var educationList = educationService.GetAllEducationList(model);
                    if (educationList != null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, educationList));
                    }
                    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));
            }
        }