public ActionResult SubmitAdd(ItemModel item, HttpPostedFileBase imgFile) { if (imgFile != null) { var file = UploadFile(imgFile.InputStream, imgFile.FileName); item.ImageSrc = file.FullName.Substring(AppDomain.CurrentDomain.BaseDirectory.Length-1).Replace('\\','/'); } DisplayModelsProvider.AddItem(item); Notify(ActionFactory.CreateSimpleAction("New Item!")); return RedirectToAction("Index"); }
public void AddItem(ItemModel itemModel) { dataProvider.AddUnit(itemModel.ToDbModel()); }