public ClientTicketModel Add(ClientTicketModel model) { using (var scope = _contextScopeFactory.Create()) { var entity = _mapper.Map <ClientTicket>(model); _repository.Add(entity); _repository.Save(); return(model); } }
public ClientTicketModel Update(ClientTicketModel model) { using (var scope = _contextScopeFactory.Create()) { var entity = _repository.GetById(model.Id); entity.ClientId = model.ClientId; entity.TicketId = model.TicketId; entity.PurchaseDate = model.PurchaseDate; entity.RemainingEntries = model.RemainingEntries; _repository.Edit(entity); _repository.Save(); return(_mapper.Map <ClientTicketModel>(entity)); } }
public IHttpActionResult Update(ClientTicketModel model) { var newModel = _service.Update(model); return(Ok(newModel)); }