Пример #1
0
        public ActionResult Create([Bind(Include = "")] AdapterBasicViewModel adapterBasicViewModel)
        {
            if (ModelState.IsValid)
            {
                using (UoW)
                {
                    _repo.Insert(new AdapterBasicDTO()
                    {
                        AdapterName      = adapterBasicViewModel.AdapterName,
                        AdapterTypeId    = adapterBasicViewModel.AdapterTypeId,
                        Id               = adapterBasicViewModel.Id,
                        IsActive         = adapterBasicViewModel.IsActive,
                        ModifiedDate     = adapterBasicViewModel.ModifiedDate,
                        RegistrationDate = adapterBasicViewModel.RegistrationDate
                    });
                }
                return(RedirectToAction("Index"));
            }

            var adapterViewModel = new AdapterBasicViewModel()
            {
                AdapterTypeList = GetAdapterTypes()
            };

            return(View(adapterViewModel));
        }
        public ActionResult Create([Bind(Include = "")] AdapterBasicDTO adapterBasicDTO)
        {
            if (ModelState.IsValid)
            {
                using (UoW)
                {
                    _repo.Insert(adapterBasicDTO);
                }
                return(RedirectToAction("Index"));
            }

            SetAdapterType();
            return(View(adapterBasicDTO));
        }
Пример #3
0
        public ActionResult Create([Bind(Include = "")] AdapterTypeViewModel adapterTypeViewModel)
        {
            try
            {
                using (UoW)
                {
                    _adapterTypesRepo.Insert(new AdapterTypeDIMDTO()
                    {
                        AdapterType  = adapterTypeViewModel.AdapterType,
                        Id           = adapterTypeViewModel.Id,
                        CreationDate = DateTime.Now,
                        ModifiedDate = DateTime.Now
                    });
                    UoW.Commit();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }