예제 #1
0
        public void Update(TMSLevelViewModel Vm)
        {
            var data = _mapper.Map <TMSLevelViewModel, TMSLevel>(Vm);

            _itmsLevelRepository.Update(data);
            SaveChanges();
        }
예제 #2
0
        public IActionResult Update([FromBody] TMSLevelViewModel Vm)
        {
            if (!ModelState.IsValid)
            {
                var allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(new GenericResult(false, allErrors)));
            }
            else
            {
                try
                {
                    _tmsLevelService.Update(Vm);

                    return(new OkObjectResult(new GenericResult(true, "Update Success")));
                }
                catch (Exception ex)
                {
                    return(new OkObjectResult(new GenericResult(false, ex.Message)));
                }
            }
        }