public async Task <ActionResult> WorkerAdd(TestModel testModel) { if (testModel == null) { return(RedirectToAction("WorkerAdd", "TestView")); } using (DenemeDb db = new DenemeDb()) { Worker worker = (Worker)testModel; db.Workers.Add(worker); await db.SaveChangesAsync(); } return(RedirectToAction("Index", "TestView")); }
public async Task <ActionResult> MarketAdd(MarketAdded marketAdded) { if (marketAdded == null) { return(RedirectToAction("MarketAdd", "Market")); } using (DenemeDb db = new DenemeDb()) { Market market = (Market)marketAdded; db.Markets.Add(market); await db.SaveChangesAsync(); } return(RedirectToAction("Index", "Market")); }