Ejemplo n.º 1
0
        /// <summary>
        /// Get StallApplication Data by ID
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult ManageStallApplication(int?Id)
        {
            List <TradingLicense.Model.SAReqDocModel> SAReqDoc = new List <Model.SAReqDocModel>();
            StallApplicationModel stallApplicationModel        = new StallApplicationModel();

            using (var ctx = new LicenseApplicationContext())
            {
                IQueryable <SAReqDoc> query = ctx.SAReqDocs;
                SAReqDoc             = Mapper.Map <List <SAReqDocModel> >(query.ToList());
                ViewBag.stallDocList = ctx.SAReqDocs.ToList();
                if (Id != null && Id > 0)
                {
                    int stallApplicationID = Convert.ToInt32(Id);
                    var stallApplication   = ctx.StallApplications.Where(a => a.StallApplicationID == stallApplicationID).FirstOrDefault();
                    stallApplicationModel = Mapper.Map <StallApplicationModel>(stallApplication);
                }
            }

            return(View(stallApplicationModel));
        }
Ejemplo n.º 2
0
        public ActionResult ManageStallApplication(StallApplicationModel stallApplicationModel)
        {
            if (ModelState.IsValid)
            {
                using (var ctx = new LicenseApplicationContext())
                {
                    StallApplication stallApplication;


                    stallApplication = Mapper.Map <StallApplication>(stallApplicationModel);
                    ctx.StallApplications.AddOrUpdate(stallApplication);
                    ctx.SaveChanges();
                }

                TempData["SuccessMessage"] = "Stall Application saved successfully.";

                return(RedirectToAction("StallApplication"));
            }
            else
            {
                return(View(stallApplicationModel));
            }
        }