Пример #1
0
        public IHttpActionResult Post([FromBody] CourseModifyViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var execution = Service.Create(model);

            if (execution.Succeded)
            {
                return(Ok(execution.Message));
            }

            return(BadRequest(execution.Message));
        }
Пример #2
0
        public IHttpActionResult Put(int id, [FromBody] CourseModifyViewModel model)
        {
            model.Id = id;

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var execution = Service.Update(model);

            if (execution.Succeded)
            {
                return(Ok(execution.Message));
            }

            return(BadRequest(execution.Message));
        }