Ejemplo n.º 1
0
        public async Task <IActionResult> Edit([FromBody] UserViewModel model)
        {
            var map = mapper.Map <User>(model);

            context.Entry(map).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(Ok());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit([FromBody] DepartmentsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var map = mapper.Map <Department>(model);

            context.Entry(map).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(Ok());
        }