예제 #1
0
        public ActionResult AddEditCarriageType(long?carriageTypeId)
        {
            var viewModel = new AddEditCarriageTypeViewModel();

            if (carriageTypeId.HasValue)
            {
                var drProducersContacts = CRCDataAccess.GetCarriageType(carriageTypeId.Value);
                drProducersContacts.MapTo(viewModel);

                viewModel.EnabledInd = !(drProducersContacts["DisabledDate"] is DateTime);
            }

            return(PartialView(viewModel));
        }
예제 #2
0
        public ActionResult AddEditCarriageType(AddEditCarriageTypeViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                CRCDataAccess.SaveCarriageType(
                    viewModel.CarriageTypeId,
                    viewModel.CarriageTypeName,
                    viewModel.EnabledInd ? (DateTime?)null : DateTime.UtcNow,
                    viewModel.EnabledInd ? (long?)null : CRCUser.UserId,
                    CRCUser.UserId);

                return(Json(true));
            }
            else
            {
                return(PartialView(viewModel));
            }
        }