Exemplo n.º 1
0
        public void Update(TMSEventTerminationResignViewModel Vm)
        {
            var data = _mapper.Map <TMSEventTerminationResignViewModel, TMSEventTerminationResign>(Vm);

            if (Vm.Id >= 1)
            {
                _tMSEventTRRepository.Update(data);
            }
            else
            {
                _tMSEventTRRepository.Add(data);
            }

            SaveChanges();
        }
Exemplo n.º 2
0
        public IActionResult Update([FromBody] TMSEventTerminationResignViewModel Vm)
        {
            if (!ModelState.IsValid)
            {
                var allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(new GenericResult(false, allErrors)));
            }
            else
            {
                try
                {
                    _tmsEventTRService.Update(Vm);

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