Example #1
0
        public PowerViewModel UdpatePower(int id, PowerViewModel power)
        {
            var powerToUpdate = _powerRepository.GetById(id);

            PowerMapper.MapModelToEntity(power, powerToUpdate);
            powerToUpdate.ModifiedBy = "TEST";
            var updatedPower = _powerRepository.Update(powerToUpdate);

            return(PowerMapper.MapEntityToModel(updatedPower));
        }
        public IActionResult Update(Power Power)
        {
            if (!ModelState.IsValid)
            {
                return(View(Power));
            }
            _repository.Update(Power);

            return(RedirectToAction("List"));
        }