Example #1
0
        // GET: PgaGrs/Create
        public ActionResult Create()
        {
            PgaGr pgaGr = new PgaGr();

            //set default value
            return(View(pgaGr));
        }
Example #2
0
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            PgaGr pgaGr = _pgaGrService.Find(id);

            _pgaGrService.Delete(pgaGr);
            _unitOfWork.SaveChanges();
            if (Request.IsAjaxRequest())
            {
                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            DisplaySuccessMessage("Has delete a PgaGr record");
            return(RedirectToAction("Index"));
        }
Example #3
0
        // GET: PgaGrs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PgaGr pgaGr = _pgaGrService.Find(id);

            if (pgaGr == null)
            {
                return(HttpNotFound());
            }
            return(View(pgaGr));
        }
Example #4
0
        //[ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,UDNo,Material,Quantity,GrDate,Warehouse,RC,Plant,Vendor,GRNo,GRItem,Area,Brand,TransmitId,StoreKey,ReceiptKey,ReceiptDate,QtyReceived,Status,Susr1,Susr2,ReceiptType,CreatedDate,ModifiedDate,CreatedBy,ModifiedBy")] PgaGr pgaGr)
        {
            if (ModelState.IsValid)
            {
                _pgaGrService.Insert(pgaGr);
                _unitOfWork.SaveChanges();
                if (Request.IsAjaxRequest())
                {
                    return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
                }
                DisplaySuccessMessage("Has append a PgaGr record");
                return(RedirectToAction("Index"));
            }

            if (Request.IsAjaxRequest())
            {
                var modelStateErrors = String.Join("", this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors.Select(n => n.ErrorMessage)));
                return(Json(new { success = false, err = modelStateErrors }, JsonRequestBehavior.AllowGet));
            }
            DisplayErrorMessage();
            return(View(pgaGr));
        }