private HelpDesk_TicketType_vm mapEntityToViewModelTicketType(HelpDesk_TicketType EFTicketType) { return(new HelpDesk_TicketType_vm { Id = EFTicketType.Id, TicketType = EFTicketType.TicketType }); }
public int EditTicketTypeById(int id, HelpDesk_TicketType type) { try { HelpDesk_TicketType oldType = _context.HelpDesk_TicketType.FirstOrDefault(x => x.Id == type.Id); if (oldType != null) { oldType.TicketType = type.TicketType; } _context.SaveChanges(); } catch (Exception ex) { _logger.Error(ex); } return(type.Id); }
public bool DeleteTicketTypeById(int id) { bool result = false; try { HelpDesk_TicketType oldType = _context.HelpDesk_TicketType.FirstOrDefault(x => x.Id == id); _context.HelpDesk_TicketType.Remove(oldType); _context.SaveChanges(); result = true; } catch (Exception ex) { _logger.Error(ex); } return(result); }
public int CreateTicketType(HelpDesk_TicketType type) { _context.HelpDesk_TicketType.Add(type); _context.SaveChanges(); return(type.Id); }