Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            FrdSupplier frdSupplier = db.FrdSuppliers.Find(id);

            db.FrdSuppliers.Remove(frdSupplier);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "SupplierID,SupplierCode,SupplierName,SupplierAddress,PhoneNumber,MobileNumber,EmailAddress,Status,ZoneCode,BranchCode,MultiFlag,Remarks,ContactPerson")] FrdSupplier frdSupplier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(frdSupplier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(frdSupplier));
 }
Esempio n. 3
0
        // GET: Suppliers/Create
        public ActionResult Create()
        {
            int value = db.FrdSuppliers.Max(a => a.SupplierID);
            int num   = value;

            FrdSupplier sup = new FrdSupplier
            {
                SupplierID = (num + 1),
            };

            return(View(sup));
        }
Esempio n. 4
0
        // GET: Suppliers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FrdSupplier frdSupplier = db.FrdSuppliers.Find(id);

            if (frdSupplier == null)
            {
                return(HttpNotFound());
            }
            return(View(frdSupplier));
        }
Esempio n. 5
0
        public ActionResult Create(FrdSupplier frdSupplier)
        {
            LIVEEntities db = new LIVEEntities();

            try
            {
                if (ModelState.IsValid)
                {
                    FrdSupplier sp = new FrdSupplier();
                    sp.SupplierID      = frdSupplier.SupplierID;
                    sp.SupplierCode    = frdSupplier.SupplierCode;
                    sp.SupplierName    = frdSupplier.SupplierName;
                    sp.SupplierAddress = frdSupplier.SupplierAddress;
                    sp.PhoneNumber     = frdSupplier.PhoneNumber;
                    sp.MobileNumber    = frdSupplier.MobileNumber;
                    sp.EmailAddress    = frdSupplier.EmailAddress;
                    sp.ZoneCode        = frdSupplier.ZoneCode;
                    sp.BranchCode      = frdSupplier.BranchCode;
                    sp.Remarks         = frdSupplier.Remarks;
                    sp.VATRegNo        = "222";
                    sp.Status          = "ACT";
                    db.FrdSuppliers.Add(sp);
                    db.SaveChanges();
                }
            }

            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
            return(RedirectToAction("Index"));
        }