コード例 #1
0
        public HttpResponseMessage Put(FuncionariosViewModel funcionariosViewModel)
        {
            if (ModelState.IsValid)
            {
                _funcionariosApp.Update(funcionariosViewModel);

                return Request.CreateResponse(HttpStatusCode.Created, "Funcionário atualizado com sucesso!");
            }
            return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
        }
コード例 #2
0
        public HttpResponseMessage Post(FuncionariosViewModel funcionariosViewModel)
        {
            if (ModelState.IsValid)
            {
                _funcionariosApp.Add(funcionariosViewModel);

                return Request.CreateResponse(HttpStatusCode.Created, funcionariosViewModel);
            }
            return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
        }