public ActionResult Edit([Bind(Include = "Id,StoreDetailId,dtPayment,Amount,StorePaymentTypeId,Remarks,dtPosted,StorePaymentStatusId")] StorePayment storePayment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(storePayment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StoreDetailId        = new SelectList(db.StoreDetails, "Id", "Name", storePayment.StoreDetailId);
     ViewBag.StorePaymentStatusId = new SelectList(db.StorePaymentStatus, "Id", "Name", storePayment.StorePaymentStatusId);
     ViewBag.StorePaymentTypeId   = new SelectList(db.StorePaymentTypes, "Id", "Description", storePayment.StorePaymentTypeId);
     return(View(storePayment));
 }
Exemple #2
0
        public async Task <IActionResult> PutCustomer([FromRoute] int id, [FromBody] Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customer.CustomerId)
            {
                return(BadRequest());
            }

            _context.Entry(customer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "ID,CompanyName,OwnerName,Address")] CompanyNameModels companyNameModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyNameModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(companyNameModels));
 }
 public ActionResult Edit([Bind(Include = "Id,Name")] ItemMaster itemMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(itemMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(itemMaster));
 }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "ID,Name,Password")] Admin admin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View("Edit", "_AdminLayout", admin));
 }
 public ActionResult Edit([Bind(Include = "ID,WelcomeNotice")] welcomeNoticeModels welcomeNoticeModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(welcomeNoticeModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(welcomeNoticeModels));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,SortOrder")] ItemCatGroup itemCatGroup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(itemCatGroup).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(itemCatGroup));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,duty,AddressLine1,AddressLine2,AddressLine3,AddressLine4,cell,phone,fax,email")] ContactModels contactModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contactModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contactModels));
 }
 public ActionResult Edit([Bind(Include = "ID,loginName,Nume,Prenume,Parola,Logged")] Admin admin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(admin));
 }
Exemple #10
0
        public ActionResult Edit([Bind(Include = "SupplierName,SupplierGroup,CompanyName,PhoneNumber,CellNumber,Email,password,BarCodeNumber,IDCardNumber,pictureURL,Published,Address")] SupplierModels supplierModels, HttpPostedFileBase filepicture)
        {
            ViewBag.CompanyNamelist   = new SelectList(db.CompanyNameModels.ToList(), "CompanyName", "CompanyName");
            ViewBag.SupplierGrouplist = new SelectList(db.SupplierGroupModels.ToList(), "GroupName", "GroupName");
            if (ModelState.IsValid)
            {
                var Prevpath = Path.Combine(Server.MapPath(db.SupplierModels.Where(m => m.SupplierName == supplierModels.SupplierName).Select(m => m.pictureURL).FirstOrDefault()));
                supplierModels.pictureURL = db.SupplierModels.Where(m => m.SupplierName == supplierModels.SupplierName).Select(m => m.pictureURL).FirstOrDefault();
                if (System.IO.File.Exists(Prevpath) && filepicture != null)
                {
                    System.IO.File.Delete(Prevpath);
                }

                if (filepicture != null)
                {
                    var allowedExtensions = new[] { ".Jpg", ".png", ".jpg", "jpeg" };
                    var fileName          = Path.GetFileName(filepicture.FileName);
                    var ext = Path.GetExtension(filepicture.FileName);              //getting the extension(ex-.jpg)
                    if (allowedExtensions.Contains(ext))                            //check what type of extension
                    {
                        string name   = Path.GetFileNameWithoutExtension(fileName); //getting file name without extension
                        string myfile = supplierModels.SupplierName + ext;          //appending the name with id
                                                                                    // store the file inside ~/project folder(Img)
                        var path = Path.Combine(Server.MapPath("~/SupplierPic/" + supplierModels.SupplierName), myfile);

                        supplierModels.pictureURL = Path.Combine("~/SupplierPic/" + supplierModels.SupplierName, myfile);
                        filepicture.SaveAs(path);
                    }
                }
                try
                {
                    db.Entry(supplierModels).State = EntityState.Modified;
                    db.SaveChanges();
                }
                catch (DbUpdateException ex)
                {
                    var sqlException = ex.InnerException.InnerException as SqlException;
                    if (sqlException != null && sqlException.Number == 2627)
                    {
                        ModelState.AddModelError("", "Supplier already registered!");
                        return(View(supplierModels));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message.ToString());
                    return(View(supplierModels));
                }
                //////////////
                /////////////
                return(RedirectToAction("Index"));
            }
            return(View(supplierModels));
        }
Exemple #11
0
 public ActionResult Edit([Bind(Include = "ID,TenderNo,DescriptionOfItem,TotalPages,TotalAmount,IDCardNo,Name,NameOfTheFirm,Address")] CashPPCModels cashPPCModels)
 {
     if (ModelState.IsValid)
     {
         cashPPCModels.PPCDate         = DateTime.Now;
         db.Entry(cashPPCModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cashPPCModels));
 }
Exemple #12
0
 public ActionResult Edit([Bind(Include = "GroupName,Description")] SupplierGroupModels supplierGroupModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplierGroupModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ModelState.AddModelError("", "Data Error!");
     return(View(supplierGroupModels));
 }
Exemple #13
0
 public ActionResult Edit([Bind(Include = "Id,Name,SortOrder,ItemCatGroupId")] ItemCategory itemCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(itemCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ItemCatGroupId = new SelectList(db.ItemCatGroups, "Id", "Name", itemCategory.ItemCatGroupId);
     return(View(itemCategory));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,MasterCityId")] MasterArea masterArea)
 {
     if (ModelState.IsValid)
     {
         db.Entry(masterArea).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MasterCityId = new SelectList(db.MasterCities, "Id", "Name", masterArea.MasterCityId);
     return(View(masterArea));
 }
 public ActionResult Edit([Bind(Include = "ID,PurchaseOrderNo,LDReferenceNo,PODate,CompanyName,LDAmount,TotalAmount,Percent")] LDModels lDModels)
 {
     ViewBag.PurchaseOrderNolist = new SelectList(db.ProcurementAndTenderModels.Where(x => x.PurchaseOrderNo != null).ToList(), "PurchaseOrderNo", "PurchaseOrderNo");
     if (ModelState.IsValid)
     {
         db.Entry(lDModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lDModels));
 }
 public ActionResult Edit([Bind(Include = "Id,UserId,Name,Address,Mobile,Remarks,RiderStatusId,MasterCityId,Mobile2")] RiderDetail riderDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(riderDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MasterCityId  = new SelectList(db.MasterCities, "Id", "Name", riderDetail.MasterCityId);
     ViewBag.RiderStatusId = new SelectList(db.RiderStatus, "Id", "Name", riderDetail.RiderStatusId);
     return(View(riderDetail));
 }
 public ActionResult Edit([Bind(Include = "Id,LoginId,Name,Address,Remarks,StoreStatusId,StoreCategoryId,MasterCityId,MasterAreaId")] StoreDetail storeDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(storeDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MasterAreaId    = new SelectList(db.MasterAreas, "Id", "Name", storeDetail.MasterAreaId);
     ViewBag.MasterCityId    = new SelectList(db.MasterCities, "Id", "Name", storeDetail.MasterCityId);
     ViewBag.StoreCategoryId = new SelectList(db.StoreCategories, "Id", "Name", storeDetail.StoreCategoryId);
     ViewBag.StoreStatusId   = new SelectList(db.StoreStatus, "Id", "Name", storeDetail.StoreStatusId);
     return(View(storeDetail));
 }
Exemple #18
0
        public ActionResult Edit([Bind(Include = "ID,DescriptionOfNotice,NoticeDownloadUrl")] GeneralNoticeModels generalNoticeModels, HttpPostedFileBase file1)
        {
            HttpPostedFileBase file = file1;

            var Prevpath = Path.Combine(Server.MapPath(db.GeneralNoticeModels.Where(m => m.ID == generalNoticeModels.ID).Select(m => m.NoticeDownloadUrl).FirstOrDefault()));

            generalNoticeModels.NoticeDownloadUrl = db.GeneralNoticeModels.Where(m => m.ID == generalNoticeModels.ID).Select(m => m.NoticeDownloadUrl).FirstOrDefault();
            if (System.IO.File.Exists(Prevpath) && file != null)
            {
                System.IO.File.Delete(Prevpath);
            }

            if (ModelState.IsValid)
            {
                ////////////////
                if (file != null)
                {
                    var allowedExtensions = new[] { ".pdf" };
                    var fileName          = Path.GetFileName(file.FileName);
                    var ext = Path.GetExtension(file.FileName);                     //getting the extension(ex-.jpg)
                    if (allowedExtensions.Contains(ext))                            //check what type of extension
                    {
                        string name   = Path.GetFileNameWithoutExtension(fileName); //getting file name without extension
                        string myfile = name + ext;                                 //appending the name with id
                                                                                    // store the file inside ~/project folder(Img)
                        var path = Path.Combine(Server.MapPath("~/GeneralNotice"), myfile);

                        if (System.IO.File.Exists(path))
                        {
                            System.IO.File.Delete(path);
                        }

                        generalNoticeModels.NoticeDownloadUrl = Path.Combine("~/GeneralNotice", myfile);

                        file.SaveAs(path);
                    }
                }
                ///////////////
                db.Entry(generalNoticeModels).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(generalNoticeModels));
        }
        public ActionResult Edit([Bind(Include = "ID,LetterID,SupplierID,SupplierContact,Quantity,Deno,price,Date,QuoteDocURL,Other1DocURL,Other2DocURL,Other3DocURL,Other4DocURL")] SuplierUploadModels suplierUploadModels,
                                 HttpPostedFileBase fileQuoteDoc, HttpPostedFileBase fileOther1Doc, HttpPostedFileBase fileOther2Doc, HttpPostedFileBase fileOther3Doc, HttpPostedFileBase fileOther4Doc)
        {
            var denolist = new List <string>();

            denolist.Add("NO"); denolist.Add("SET"); denolist.Add("L/I"); denolist.Add("LTR");
            denolist.Add("MTR"); denolist.Add("LINE"); denolist.Add("CFT"); denolist.Add("PCS"); denolist.Add("PRS"); denolist.Add("SHT");
            denolist.Add("KG"); denolist.Add("BOX"); denolist.Add("PKT"); denolist.Add("COPY"); denolist.Add("RM"); denolist.Add("Roll");
            denolist.Add("Lbs"); denolist.Add("Bottle"); denolist.Add("Feet"); denolist.Add("Metric Ton"); denolist.Add("Other");
            ViewBag.denolist = new SelectList(denolist);

            ViewBag.let = suplierUploadModels.LetterID;
            ViewBag.sup = suplierUploadModels.SupplierID;

            ViewBag.details  = db.ProcurementAndTenderModels.Where(x => x.ID == suplierUploadModels.LetterID).Select(x => x.ItemDescription).FirstOrDefault();
            ViewBag.quantity = db.ProcurementAndTenderModels.Where(x => x.ID == suplierUploadModels.LetterID).Select(x => x.Quantity).FirstOrDefault();

            var PrevpathfileQuote = Path.Combine(Server.MapPath(db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.QuoteDocURL).FirstOrDefault()));

            suplierUploadModels.QuoteDocURL = db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.QuoteDocURL).FirstOrDefault();
            if (System.IO.File.Exists(PrevpathfileQuote) && fileQuoteDoc != null)
            {
                System.IO.File.Delete(PrevpathfileQuote);
            }

            var PrevpathfileOther1 = Path.Combine(Server.MapPath(db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other1DocURL).FirstOrDefault()));

            suplierUploadModels.Other1DocURL = db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other1DocURL).FirstOrDefault();
            if (System.IO.File.Exists(PrevpathfileOther1) && fileOther1Doc != null)
            {
                System.IO.File.Delete(PrevpathfileOther1);
            }

            var PrevpathfileOther2 = Path.Combine(Server.MapPath(db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other2DocURL).FirstOrDefault()));

            suplierUploadModels.Other2DocURL = db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other2DocURL).FirstOrDefault();
            if (System.IO.File.Exists(PrevpathfileOther2) && fileOther2Doc != null)
            {
                System.IO.File.Delete(PrevpathfileOther2);
            }

            var PrevpathfileOther3 = Path.Combine(Server.MapPath(db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other3DocURL).FirstOrDefault()));

            suplierUploadModels.Other3DocURL = db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other3DocURL).FirstOrDefault();
            if (System.IO.File.Exists(PrevpathfileOther3) && fileOther3Doc != null)
            {
                System.IO.File.Delete(PrevpathfileOther3);
            }

            var PrevpathfileOther4 = Path.Combine(Server.MapPath(db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other4DocURL).FirstOrDefault()));

            suplierUploadModels.Other4DocURL = db.SuplierUploadModels.Where(m => m.SupplierID == suplierUploadModels.SupplierID).Select(m => m.Other4DocURL).FirstOrDefault();
            if (System.IO.File.Exists(PrevpathfileOther4) && fileOther4Doc != null)
            {
                System.IO.File.Delete(PrevpathfileOther4);
            }

            if (ModelState.IsValid)
            {
                string subPath = "~/SupplierUpload/" + suplierUploadModels.SupplierID + "/" + suplierUploadModels.LetterID.ToString() + "/" + "quote"; // your code goes here
                bool   exists  = System.IO.Directory.Exists(Server.MapPath(subPath));
                if (!exists)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
                }

                if (fileQuoteDoc != null)
                {
                    upload_file(fileQuoteDoc, suplierUploadModels, "quote", suplierUploadModels.LetterID);
                }
                ////////
                subPath = "~/SupplierUpload/" + suplierUploadModels.SupplierID + "/" + suplierUploadModels.LetterID.ToString() + "/" + "other1"; // your code goes here
                exists  = System.IO.Directory.Exists(Server.MapPath(subPath));
                if (!exists)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
                }

                if (fileOther1Doc != null)
                {
                    upload_file(fileOther1Doc, suplierUploadModels, "other1", suplierUploadModels.LetterID);
                }
                ////////
                ////////
                subPath = "~/SupplierUpload/" + suplierUploadModels.SupplierID + "/" + suplierUploadModels.LetterID.ToString() + "/" + "other2"; // your code goes here
                exists  = System.IO.Directory.Exists(Server.MapPath(subPath));
                if (!exists)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
                }

                if (fileOther2Doc != null)
                {
                    upload_file(fileOther2Doc, suplierUploadModels, "other2", suplierUploadModels.LetterID);
                }
                ////////
                ////////
                subPath = "~/SupplierUpload/" + suplierUploadModels.SupplierID + "/" + suplierUploadModels.LetterID.ToString() + "/" + "other3"; // your code goes here
                exists  = System.IO.Directory.Exists(Server.MapPath(subPath));
                if (!exists)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
                }

                if (fileOther3Doc != null)
                {
                    upload_file(fileOther3Doc, suplierUploadModels, "other3", suplierUploadModels.LetterID);
                }
                ////////
                ////////
                subPath = "~/SupplierUpload/" + suplierUploadModels.SupplierID + "/" + suplierUploadModels.LetterID.ToString() + "/" + "other4"; // your code goes here
                exists  = System.IO.Directory.Exists(Server.MapPath(subPath));
                if (!exists)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
                }

                if (fileOther4Doc != null)
                {
                    upload_file(fileOther4Doc, suplierUploadModels, "other4", suplierUploadModels.LetterID);
                }
                ////////

                db.Entry(suplierUploadModels).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("ProcurementFrontPage", "ProcurementAndTenderModels"));
                //return RedirectToAction("Index");
            }
            return(View(suplierUploadModels));
        }