public void AddPartType(AdminAddParttypwViewModel model) { var res = new PartType(); { res.PartTypeName = model.PartTypeName; res.PackageId = model.Partss; res.PartTypeImageUrl = model.PartTypeImageUrl; _context.PartTypes.Add(res); _context.SaveChanges(); }; }
public ActionResult AddParttype() { AdminAddParttypwViewModel model = new AdminAddParttypwViewModel(); List <Package> list = _productservice.GetAllPackages_(); foreach (var item in list) { model.SelectListItems.Add(new SelectListItem { Text = item.PackageName, Value = item.PackageID.ToString() }); } return(View(model)); }
public ActionResult AddParttype(AdminAddParttypwViewModel model) { if (!ModelState.IsValid) { List <Package> list = _productservice.GetAllPackages_(); foreach (var item in list) { model.SelectListItems.Add(new SelectListItem { Text = item.PackageName, Value = item.PackageID.ToString() }); } return(View(model)); } _productservice.AddPartType(model); return(RedirectToAction("Thankyou")); }
public void AddPartType(AdminAddParttypwViewModel model) { _repository.AddPartType(model); }