public HttpResponseMessage AddMessage(ContactUsMessageModel contactUsMessageModel) { try { if (!ModelState.IsValid) { List <PropErrors> errorList = ErrorExtractor.ExtractError(ModelState); return(Request.CreateResponse(HttpStatusCode.BadRequest, errorList));//badrequest = 400 } ContactUsMessageModel contactUsMessage = contactLogic.AddMsg(contactUsMessageModel); return(Request.CreateResponse(HttpStatusCode.Created, contactUsMessage)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public HttpResponseMessage Login(UserDetailsModel userDetailModel) { try { if (!ModelState.IsValid) { List <PropErrors> errorList = ErrorExtractor.ExtractError(ModelState); return(Request.CreateResponse(HttpStatusCode.BadRequest, errorList));//badrequest = 400 } else { UserDetailsModel userDetail = userdetailslogic.Login(userDetailModel); return(Request.CreateResponse(HttpStatusCode.Created, userDetail)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }