Beispiel #1
0
 public HttpResponseMessage GetUser(logInDTO logIn)
 {
     try
     {
         userDTO userFound = logic.GetUser(logIn);
         return(Request.CreateResponse(HttpStatusCode.OK, userFound));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(
                    HttpStatusCode.InternalServerError,
                    ErrorsManager.GetInnerMessage(ex)));
     }
 }
Beispiel #2
0
        public HttpResponseMessage GeBranches(branchDTO branch)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest,
                                                  ErrorsManager.GetErrors(ModelState)));
                }

                List <branchDTO> getranch = logic.getBranch();
                return(Request.CreateResponse(HttpStatusCode.OK, getranch));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.InternalServerError,
                           ErrorsManager.GetInnerMessage(ex)));
            }
        }
Beispiel #3
0
        public HttpResponseMessage AddProduct(userDTO user)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest,
                                                  ErrorsManager.GetErrors(ModelState)));
                }

                string addedProduct = logic.AddUser(user);
                return(Request.CreateResponse(HttpStatusCode.Created, addedProduct));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.InternalServerError,
                           ErrorsManager.GetInnerMessage(ex)));
            }
        }