public async Task sendAdditional(Notification notification, additionalService additionalService, Collection <Service> services) { addServRepository.Add(additionalService); var serv = addServRepository.additionalServices.Last(); serv = addServRepository.additionalServices.Last(); var s = typeof(additionalService).ToString(); notification.type = s.Split(".").Last(); notification.objectId = serv.Id; //if (notification.mechanicId == 0) //{ // int mechId = statOfVehicleRepository.statusOfVehicles // .Where(s => s.Id == serv.statusOfVehicleId) // .Select(s => s.mechanicId).FirstOrDefault(); // notification.mechanicId = mechId; // notificationRepository.Add(notification); // var notif = notificationRepository.notifications.Last(); // await Clients.All.SendAsync("ReceiveAdditionalRequest", notif, mechId); //} //else if (notification.customerId == 0) //{ int custId = statOfVehicleRepository.statusOfVehicles .Where(s => s.Id == serv.statusOfVehicleId) .Select(s => s.customerId).FirstOrDefault(); notification.customerId = custId; notificationRepository.Add(notification); var notif = notificationRepository.notifications.Last(); await Clients.All.SendAsync("ReceiveNotification", notif); //} //else await Clients.All.SendAsync("notif", "hello"); }
public bool sendAddReqMech(additionalService additionalService) => addServ.Add(additionalService);
public bool sendAddReqCustomer(additionalService additionalService) => addServ.Add(additionalService);
public bool updateAddService(additionalService additionalService) => addServ.Update(additionalService);
public IActionResult sendAddMechanic([FromBody] additionalService additionalService) => Ok(ash.sendAddReqMech(additionalService));
public IActionResult updateService([FromBody] additionalService additionalService) => Ok(ash.updateAddService(additionalService));
public IActionResult sendAddCustomer([FromBody] additionalService additionalService) => Ok(ash.sendAddReqCustomer(additionalService));
public bool Update(additionalService additionalService) { context.additionalServices.Update(additionalService); return(context.SaveChanges() != 0 ? true : false); }