Пример #1
0
        public IHttpActionResult PostService(ServiceViewModel service)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            serviceRepository.UpdateService(service.MapTo <Service>());

            return(Ok(service));
        }
Пример #2
0
        public IHttpActionResult PutService(int id, ServiceViewModel service)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != service.Id)
            {
                return(BadRequest());
            }

            serviceRepository.UpdateService(service.MapTo <Service>());

            return(StatusCode(HttpStatusCode.NoContent));
        }