public ActionResult Edit(int ServiceId, int BarberId, ServicetoBarber servicetoBarberI) { //if (!ModelState.IsValid) return View(servicetoBarber); ServicetoBarber servicetoBarberB = _context.ServicetoBarbers.Find(servicetoBarberI.Id); servicetoBarberB.ServiceId = ServiceId; servicetoBarberB.BarberId = BarberId; _context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(int ServiceId, int BarberId) { //var ServiceI = _context.Services.Find(ServiceId); //var BarberI = _context.Services.Find(BarberId); ServicetoBarber servicetoBarber = new ServicetoBarber { ServiceId = ServiceId, BarberId = BarberId }; _context.ServicetoBarbers.Add(servicetoBarber); _context.SaveChanges(); return(RedirectToAction("Index")); }