Пример #1
0
        public ActionResult Create(BaseModel baseModel)
        {
            TruckExpenseModel truckExpenseModel = new TruckExpenseModel();

            truckExpenseModel.CopyBaseModel(baseModel);

            using (TruckExpenseBAL truckExpenseBAL = new TruckExpenseBAL(ContextInfo))
            {
                truckExpenseBAL.PrepareTruckExpenseModel(truckExpenseModel);
            }

            return(View("Create", truckExpenseModel));
        }
Пример #2
0
        // GET: TruckExpense/Edit/5
        public ActionResult Edit(string id, BaseModel baseModel)
        {
            TruckExpenseModel truckExpenseModel = new TruckExpenseModel();

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

            using (TruckExpenseBAL truckExpenseBAL = new TruckExpenseBAL(ContextInfo))
            {
                truckExpenseBAL.GetTruckExpenseModel(truckExpenseModel);
                truckExpenseBAL.PrepareTruckExpenseModel(truckExpenseModel);
            }

            return(View(truckExpenseModel));
        }
Пример #3
0
        public ActionResult Create(TruckExpenseModel truckExpenseModel)
        {
            ModelState.Clear <TruckExpenseModel>(x => x.TruckModel);

            using (TruckExpenseBAL truckExpenseBAL = new TruckExpenseBAL(ContextInfo))
            {
                if (ModelState.IsValid)
                {
                    truckExpenseBAL.Create(truckExpenseModel);
                }

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

                truckExpenseBAL.PrepareTruckExpenseModel(truckExpenseModel);
            }

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