示例#1
0
        // GET: /Voucher/Edit/5
        public ActionResult Edit(long?id)
        {
            TempData.Remove("message");
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VoucherNumbering vouchernumbering = db.VoucherNumberings.Find(id);

            if (vouchernumbering == null)
            {
                return(HttpNotFound());
            }
            Mapper.CreateMap <VoucherNumbering, VoucherNumberingModel>();
            var voucherModel = Mapper.Map <VoucherNumbering, VoucherNumberingModel>(vouchernumbering);

            //voucher config
            int?voucherType = db.Company_Info.ToList().FirstOrDefault().VoucherIncrementType;

            ViewBag.VoucherType = voucherType;
            if (voucherType == 1)
            {
                var voucherConfig = db.VoucherConfigurations.ToList().FirstOrDefault();
                ViewBag.VoucherType = voucherType;
                ViewBag.StartNo     = voucherConfig.StartNo;
                ViewBag.EndNo       = voucherConfig.EndNo;
                ViewBag.BodyLength  = voucherConfig.BodyLength;
            }

            ViewBag.CategoryId = new SelectList(db.Categories, "CategoryID", "Name", voucherModel.CategoryId);

            return(View(voucherModel));
        }
示例#2
0
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(long id)
        {
            VoucherNumbering vouchernumbering = db.VoucherNumberings.Find(id);

            db.VoucherNumberings.Remove(vouchernumbering);
            db.SaveChanges();

            var status = "Document design deleted successfully";

            return(Json(status));
        }
示例#3
0
        // GET: /Voucher/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VoucherNumbering vouchernumbering = db.VoucherNumberings.Find(id);

            if (vouchernumbering == null)
            {
                return(HttpNotFound());
            }
            return(View(vouchernumbering));
        }
示例#4
0
        // GET: /Voucher/Delete/5
        public ActionResult Delete(long?id)
        {
            TempData.Remove("message");
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VoucherNumbering vouchernumbering = db.VoucherNumberings.Find(id);

            if (vouchernumbering == null)
            {
                return(HttpNotFound());
            }
            return(View(vouchernumbering));
        }