Esempio n. 1
0
        public ActionResult Create(BaseModel baseModel)
        {
            TruckModel truckModel = new TruckModel();

            truckModel.CopyBaseModel(baseModel);

            using (TruckBAL truckBAL = new TruckBAL(ContextInfo))
            {
                truckBAL.PrepareTruckModel(truckModel);
            }

            return(View("Create", truckModel));
        }
Esempio n. 2
0
        // GET: Truck/Edit/5
        public ActionResult Edit(string id, BaseModel baseModel)
        {
            TruckModel truckModel = new TruckModel();

            truckModel.CopyBaseModel(baseModel);
            truckModel.Id = id;

            using (TruckBAL truckBAL = new TruckBAL(ContextInfo))
            {
                truckBAL.GetTruckModel(truckModel);
                truckBAL.PrepareTruckModel(truckModel);
            }

            return(View(truckModel));
        }
Esempio n. 3
0
        public ActionResult Create(TruckModel truckModel)
        {
            ModelState.Clear <TruckModel>(x => x.DriverModel);

            using (TruckBAL truckBAL = new TruckBAL(ContextInfo))
            {
                if (ModelState.IsValid)
                {
                    truckBAL.Create(truckModel);
                }

                if (truckModel.HasErrorByType(LMYFrameWorkMVC.Common.LookUps.ErrorType.Critical) || truckModel.HasSuccess(LMYFrameWorkMVC.Common.LookUps.SuccessType.Full))
                {
                    return(base.RedirectToActionWithData(new Dictionary <string, object> {
                        { "baseModel", truckModel }
                    }));
                }

                truckBAL.PrepareTruckModel(truckModel);
            }

            return(View("Create", truckModel));
        }