public ActionResult Put(Guid id, RateTypeCreateDto dto) { var entity = _service.Update(id, dto); if (entity == null) { return(NotFound()); } return(Ok(entity)); }
public RateTypeConfirmationDto Create(RateTypeCreateDto dto) { RateType rateType = new RateType() { Id = Guid.NewGuid(), RateTypeName = dto.RateTypeName }; _context.RateTypes.Add(rateType); _context.SaveChanges(); _logger.Log("Create RateType"); return(_mapper.Map <RateTypeConfirmationDto>(rateType)); }
public RateTypeConfirmationDto Update(Guid id, RateTypeCreateDto dto) { var rate = _context.RateTypes.FirstOrDefault(e => e.Id == id); if (rate == null) { return(null); } rate.RateTypeName = dto.RateTypeName; _context.SaveChanges(); _logger.Log("Update RateType"); return(_mapper.Map <RateTypeConfirmationDto>(rate)); }
public ActionResult Post([FromBody] RateTypeCreateDto dto) { var entity = _service.Create(dto); return(Ok(entity)); }