Exemple #1
0
        public void Update(TMSLocationViewModel Vm)
        {
            var data = _mapper.Map <TMSLocationViewModel, TMSLocation>(Vm);

            _itmsLocationRepository.Update(data);
            SaveChanges();
        }
        public IActionResult Update([FromBody] TMSLocationViewModel Vm)
        {
            if (!ModelState.IsValid)
            {
                var allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(new GenericResult(false, allErrors)));
            }
            else
            {
                try
                {
                    _tmsLocationService.Update(Vm);

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