public IActionResult AssinTicket([FromBody] AssignTicketResource model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } model.Status = false; repository.AssignTicket(model); unitOfWork.CompleteAsync(); return(Ok(model)); }
public void AssignTicket(AssignTicketResource assignTicketResource) { var TicketsAssign = context.TicketsAssign.Where(ug => ug.TicketId == assignTicketResource.TicketId && ug.GroupId == assignTicketResource.GroupId).FirstOrDefault(); if (TicketsAssign == null) { context.TicketsAssign.Add(new TicketAssign { TicketId = assignTicketResource.TicketId, GroupId = assignTicketResource.GroupId, AssignDate = DateTime.Now, Status = assignTicketResource.Status }); } else { if (assignTicketResource.IsRemoved) { context.TicketsAssign.Remove(TicketsAssign); } } }