public ActionResult Add(ECommerceContainer model) { if (Session["UserName"] == null) { return(RedirectToAction("Index", "Account")); } ViewBag.ReportTitle = "Add new expense"; AddECommerceContainer(model); return(RedirectToAction("Index")); }
public ActionResult Add() { // add new user if (Session["UserName"] == null) { return(RedirectToAction("Index", "Account")); } ViewBag.ReportTitle = "Create new container"; var model = new ECommerceContainer(); return(View(model)); }
public void AddECommerceContainer(ECommerceContainer model) { string sqlInsert = "INSERT tblcontainer (ContainerName, ContainerNumber, ShippedDate, EstimateArrivalDate, ArrivalDate, UnloadDate, MarketDate, UnloadBy, UnloadTimePeriod, Notes) " + "VALUE (@ContainerName, @ContainerNumber, @ShippedDate, @EstimateArrivalDate, @ArrivalDate, @UnloadDate, @MarketDate, @UnloadBy, @UnloadTimePeriod, @Notes)"; using (MySqlConnection connection = new MySqlConnection(Helpers.Helpers.GetERPConnectionString())) { try { int result = connection.Execute(sqlInsert, model); } catch (Exception ex) { throw new Exception(ex.Message); } finally { connection.Close(); } } }