public async Task <IActionResult> New(MonafastViewModel model) { if (ModelState.IsValid) { string uniqueFileName = UploadedFile(model); Monafsa monafsa = new Monafsa { Name = model.Name, EngineerId = model.EngineerId, LastDate = model.LastDate, PdfFile = uniqueFileName, Advertiser = model.Advertiser, Note = model.Note, Price = model.Price, Sadad = model.Sadad, StatuId = model.StatuId }; dbContext.Add(monafsa); await dbContext.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View()); }
public async Task <IActionResult> Create([Bind("Id,Name")] Statu statu) { if (ModelState.IsValid) { _context.Add(statu); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(statu)); }
public async Task <IActionResult> Create([Bind("Id,Name,Advertiser,LastDate,Price,StatuId,EngineerId,Sadad")] Monafsa monafsa) { if (ModelState.IsValid) { _context.Add(monafsa); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EngineerId"] = new SelectList(_context.Engineers, "Id", "Id", monafsa.EngineerId); ViewData["StatuId"] = new SelectList(_context.Status, "Id", "Id", monafsa.StatuId); return(View(monafsa)); }