Esempio n. 1
0
 public ClientTicketModel Add(ClientTicketModel model)
 {
     using (var scope = _contextScopeFactory.Create())
     {
         var entity = _mapper.Map <ClientTicket>(model);
         _repository.Add(entity);
         _repository.Save();
         return(model);
     }
 }
Esempio n. 2
0
 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));
     }
 }
Esempio n. 3
0
        public IHttpActionResult Update(ClientTicketModel model)
        {
            var newModel = _service.Update(model);

            return(Ok(newModel));
        }