public async Task <ActionResult> AssignDelivMan(AssignDelivManToBooking assign) { var isBookingExists = await _unitOfWork.Bookings.FindBookingById(assign.BookingId); var isDelivManExists = await _unitOfWork.DeliveryMan.FindByDeliveryManByIdAsync(assign.DelivManId); //Delivery-Man Identity if (isBookingExists == null || isDelivManExists == null) { return(BadRequest("Don't exists!")); } var assignedDelivMan = new AssignedDelivMan { BookingId = assign.BookingId, DelivManId = assign.DelivManId }; await _unitOfWork.AssignedDelivMan.Add(assignedDelivMan); var result = await _unitOfWork.CompleteAsync(); if (result == 0) { return(BadRequest("Assigned Failled!")); } return(Ok()); }
public async Task Add(AssignedDelivMan assignedDelivMan) { await _context.AssignedDelivMen.AddAsync(assignedDelivMan); }