public bool SaveTicketType(TicketType ticketType) { if (ticketType.TicketTypeId > 0) { ticketTypeRepository.Update(ticketType); } else { ticketTypeRepository.Add(ticketType); } ticketTypeRepository.SaveChanges(); return(true); }
public string UpdateTicketType(TicketTypeRowViewModel model) { var existedTicketType = _ticketTypeRepository.Get(x => x.Deleted == false && x.Id == model.Id); if (existedTicketType == null) { return("Ticket Type Not Found"); } if (model.Name != null && !model.Name.Equals("")) { existedTicketType.Name = model.Name; } if (model.VehicleId.ToString() != null && !model.VehicleId.Equals("")) { existedTicketType.VehicleId = model.VehicleId; } existedTicketType.UpdatedAtUTC = DateTime.UtcNow; _ticketTypeRepository.Update(existedTicketType); _unitOfWork.CommitChanges(); return(string.Empty); }
public async Task <ActionResult> Update(int id, [FromBody] TicketType ticketType) { try { var response = await _ticketTypeRepository.Update(id, ticketType); if (response > 0) { return(Ok(new { message = "Ticket type updated!" })); } else { return(NotFound(new { message = "Ticket type not found!" })); } } catch (Exception ex) { return(Problem(ex.Message)); } }
public void UpdateTicketType(TicketType TicketType) { _iRespository.Update(TicketType); }
public JsonResult Update(TicketType record) { _ticketTypeRepository.Update(record); return(Json(record)); }