public IActionResult UpdateCarWorkShop(int id, CarWorkShop carWorkShopToUpdate) { var carWorkShopFromRepo = _repo.GetCarWorkShop(id); _mapper.Map(carWorkShopToUpdate, carWorkShopFromRepo); return(NoContent()); }
public void AddCarWorkShop(CarWorkShop entity) { var firstCarWorkShop = _context.CarWorkShops.OrderByDescending(u => u.CompanyId).First(); entity.CompanyId = firstCarWorkShop.CompanyId + 1; _context.CarWorkShops.Add(entity); }
public IActionResult Register(CarWorkShop carWorkShopForRegister) { carWorkShopForRegister.CompanyName = carWorkShopForRegister.CompanyName.ToLower(); if (_repo.CarWorkShopExsist(carWorkShopForRegister.CompanyName)) { return(BadRequest("Company name already exsist")); } _repo.AddCarWorkShop(carWorkShopForRegister); return(Ok(carWorkShopForRegister)); }
public void DeleteCarWorkShop(CarWorkShop entity) { _context.CarWorkShops.Remove(entity); }
public void AddCarWorkShop(CarWorkShop entity) { _context.CarWorkShops.Add(entity); }