コード例 #1
0
        public ActionResult Create(tbl_EndUsage tbl_endusage)
        {
            tbl_endusage.CreatedBy = User.Identity.Name;
            tbl_endusage.CreatedDate = DateTime.Now;

            if (ModelState.IsValid)
            {
                //check if record already exists
                //tbl_EndUsage entity = db.tbl_EndUsage.Where(e => e.EndUsage == tbl_endusage.EndUsage && e.SubEndUsage==tbl_endusage.SubEndUsage).SingleOrDefault();
                //if (entity != null)
                //{
                //    ModelState.AddModelError("","End Usage and Sub End Usage already exists");
                //}
                //else
                //{
                    db.tbl_EndUsage.AddObject(tbl_endusage);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                //}
            }

            return View(tbl_endusage);
        }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_EndUsage EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_EndUsage(tbl_EndUsage tbl_EndUsage)
 {
     base.AddObject("tbl_EndUsage", tbl_EndUsage);
 }
コード例 #3
0
 /// <summary>
 /// Create a new tbl_EndUsage object.
 /// </summary>
 /// <param name="endUsage_Id">Initial value of the EndUsage_Id property.</param>
 /// <param name="endUsage">Initial value of the EndUsage property.</param>
 /// <param name="product">Initial value of the Product property.</param>
 /// <param name="gSMRange">Initial value of the GSMRange property.</param>
 /// <param name="availability">Initial value of the Availability property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 public static tbl_EndUsage Createtbl_EndUsage(global::System.Int32 endUsage_Id, global::System.String endUsage, global::System.String product, global::System.String gSMRange, global::System.String availability, global::System.String createdBy, global::System.DateTime createdDate)
 {
     tbl_EndUsage tbl_EndUsage = new tbl_EndUsage();
     tbl_EndUsage.EndUsage_Id = endUsage_Id;
     tbl_EndUsage.EndUsage = endUsage;
     tbl_EndUsage.Product = product;
     tbl_EndUsage.GSMRange = gSMRange;
     tbl_EndUsage.Availability = availability;
     tbl_EndUsage.CreatedBy = createdBy;
     tbl_EndUsage.CreatedDate = createdDate;
     return tbl_EndUsage;
 }
コード例 #4
0
 public ActionResult Edit(tbl_EndUsage tbl_endusage)
 {
     tbl_endusage.ModifiedBy = User.Identity.Name;
     tbl_endusage.ModifiedDate = DateTime.Now;
     if (ModelState.IsValid)
     {
         db.tbl_EndUsage.Attach(tbl_endusage);
         db.ObjectStateManager.ChangeObjectState(tbl_endusage, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(tbl_endusage);
 }