public void Update(TMSShiftJobSiteViewModel Vm)
        {
            var data = _mapper.Map <TMSShiftJobSiteViewModel, TMSShiftJobSite>(Vm);

            _itmsShiftJobSiteRepository.Update(data);
            SaveChanges();
        }
示例#2
0
        public IActionResult Update([FromBody] TMSShiftJobSiteViewModel Vm)
        {
            if (!ModelState.IsValid)
            {
                var allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(new GenericResult(false, allErrors)));
            }
            else
            {
                try
                {
                    _tmsShiftJobSiteService.Update(Vm);

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