public async Task <IHttpActionResult> SeedTicketTime() { List <string> times = new List <string>(); string t; for (int i = 9; i < 17; i++) { for (int j = 0; j < 45; j += 15) { if (j == 0) { t = i.ToString() + ":" + j.ToString() + "0"; } else { t = i.ToString() + ":" + j.ToString(); } times.Add(t); } } foreach (var ti in times) { TicketTime ticketTime = new TicketTime { Time = ti }; await _ticketService.SaveTicketTimeAsync(ticketTime); } return(Ok()); }
public async Task <IActionResult> AddTime([FromForm] TicketTime time) { _context.TechnicianTicketTimes.Add(new TechnicianTicketTime { End = time.End, Start = time.Start, TicketId = time.TicketId, TechnicianId = _userManager.GetUserName(User) }); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Open), new { id = time.TicketId })); }
public Task SaveTicketTimeAsync(TicketTime ticketTime) { _context.TicketTime.Add(Mapper.Map <Data.Access.BankManagement.TicketTime>(ticketTime)); return(_context.SaveChangesAsync()); }