コード例 #1
0
        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");
        }
コード例 #2
0
 public bool sendAddReqMech(additionalService additionalService) =>
 addServ.Add(additionalService);
コード例 #3
0
 public bool sendAddReqCustomer(additionalService additionalService) =>
 addServ.Add(additionalService);
コード例 #4
0
 public bool updateAddService(additionalService additionalService) =>
 addServ.Update(additionalService);
コード例 #5
0
 public IActionResult sendAddMechanic([FromBody] additionalService additionalService)
 => Ok(ash.sendAddReqMech(additionalService));
コード例 #6
0
 public IActionResult updateService([FromBody] additionalService additionalService)
 => Ok(ash.updateAddService(additionalService));
コード例 #7
0
 public IActionResult sendAddCustomer([FromBody] additionalService additionalService)
 => Ok(ash.sendAddReqCustomer(additionalService));
コード例 #8
0
 public bool Update(additionalService additionalService)
 {
     context.additionalServices.Update(additionalService);
     return(context.SaveChanges() != 0 ? true : false);
 }