Esempio n. 1
0
        public IActionResult Post([FromBody] EducationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entity = model.ToEntity();

            entity.Id = 0;
            _educationService.Insert(entity);

            //locales
            UpdateLocales(entity, model);

            return(NoContent());
        }
Esempio n. 2
0
        public ActionResult Put(int id, [FromBody] EducationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entity = _educationService.GetById(model.Id);

            entity = model.ToEntity(entity);
            _educationService.Update(entity);

            //locales
            UpdateLocales(entity, model);

            return(NoContent());
        }