public async Task <IActionResult> PutUserServiceInfo(string id, UserServiceInfo userServiceInfo) { if (id != userServiceInfo.Usid) { return(BadRequest()); } _context.Entry(userServiceInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserServiceInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <Booking> PostBooking(Booking item) { Booking book = null; if (item == null) { throw new NullReferenceException(); } else { book = new Booking { CustomerId = item.CustomerId, ServiceProviderId = item.ServiceProviderId, Servicedate = item.Servicedate, Starttime = item.Starttime, Endtime = item.Endtime, Estimatedcost = item.Estimatedcost, Bookingstatus = item.Bookingstatus, Servicestatus = item.Servicestatus, Rating = item.Rating }; await _context.Bookings.AddAsync(book); await _context.SaveChangesAsync(); } return(book); }