public ActionResult Create([Bind(Include = "PartyID,PartyName,Address,CountryID,StateID,CityID,ContactPerson,Mobile,Phone,Email,PartyTypeID,CompanyID,UserID,Description,Created,Modofied,Remarks,IsActive,PanNo,TanNo,AadharNo,GSTIN")] MST_Party mST_Party) { if (ModelState.IsValid) { mST_Party.Created = DateTime.Now; mST_Party.Modofied = DateTime.Now; mST_Party.CompanyID = 4; if (Session["UserID"] != null) { mST_Party.UserID = Convert.ToInt16(Session["UserID"].ToString()); } db.MST_Party.Add(mST_Party); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CityID = new SelectList(db.LOC_City, "CityID", "CityName", mST_Party.CityID); ViewBag.CountryID = new SelectList(db.LOC_Country, "CountryID", "CountryName", mST_Party.CountryID); ViewBag.StateID = new SelectList(db.LOC_State, "StateID", "StateName", mST_Party.StateID); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", mST_Party.CompanyID); ViewBag.PartyTypeID = new SelectList(db.SYS_PartyType, "PartyTypeID", "PartyType", mST_Party.PartyTypeID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", mST_Party.UserID); return(View(mST_Party)); }
// GET: MST_Party/Create public ActionResult Create() { ViewBag.CityID = new SelectList(db.LOC_City, "CityID", "CityName"); ViewBag.CountryID = new SelectList(db.LOC_Country, "CountryID", "CountryName"); ViewBag.StateID = new SelectList(db.LOC_State, "StateID", "StateName"); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName"); ViewBag.PartyTypeID = new SelectList(db.SYS_PartyType, "PartyTypeID", "PartyType"); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName"); MST_Party _mST_Party = new MST_Party(); return(View("Edit", _mST_Party)); }
// GET: MST_Party/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MST_Party mST_Party = db.MST_Party.Find(id); if (mST_Party == null) { return(HttpNotFound()); } return(View(mST_Party)); }
public ActionResult DeleteConfirmed(int id) { MST_Party mST_Party = db.MST_Party.Find(id); try { db.MST_Party.Remove(mST_Party); db.SaveChanges(); } catch (Exception ex) { ModelState.AddModelError("", "You can not Delete this Employee."); return(View(mST_Party)); } return(RedirectToAction("Index")); }
// GET: MST_Party/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MST_Party mST_Party = db.MST_Party.Find(id); if (mST_Party == null) { return(HttpNotFound()); } ViewBag.CityID = new SelectList(db.LOC_City, "CityID", "CityName", mST_Party.CityID); ViewBag.CountryID = new SelectList(db.LOC_Country, "CountryID", "CountryName", mST_Party.CountryID); ViewBag.StateID = new SelectList(db.LOC_State, "StateID", "StateName", mST_Party.StateID); ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", mST_Party.CompanyID); ViewBag.PartyTypeID = new SelectList(db.SYS_PartyType, "PartyTypeID", "PartyType", mST_Party.PartyTypeID); ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", mST_Party.UserID); return(View(mST_Party)); }