Esempio n. 1
0
 public Admin2ViewModel Update(Admin2ViewModel obj)
 {
     BeginTransaction();
     _adminService.Update(Mapper.Map <Admin2ViewModel, Admin>(obj));
     Commit();
     return(obj);
 }
Esempio n. 2
0
        public Admin2ViewModel Add(Admin2ViewModel obj)
        {
            var admin = Mapper.Map <Admin2ViewModel, Admin>(obj);

            BeginTransaction();
            _adminService.Add(admin);
            Commit();
            return(obj);
        }
        public ActionResult Edit(Admin2ViewModel admin2ViewModel)
        {
            if (ModelState.IsValid)
            {
                _adminAppService.Update(admin2ViewModel);
                return RedirectToAction("Index");
            }

            return View(admin2ViewModel);
        }
        public ActionResult Create(Admin2ViewModel admin2ViewModel)
        {
            if (ModelState.IsValid)
            {
                admin2ViewModel.AdminId = Guid.NewGuid();
                _adminAppService.Add(admin2ViewModel);
                return RedirectToAction("Index");
            }

            return View(admin2ViewModel);
        }
        private void AdicionarAdministrador(RegisterViewModel model)
        {
            var admin = new Admin2ViewModel
            {
                Nome     = model.Nome,
                Ativo    = true,
                Email    = model.Email,
                Empresa  = model.Empresa,
                Cnpj     = model.Cnpj,
                Telefone = model.Telefone,
                Senha    = model.Password,
                Imagem   = model.Imagem
            };

            _adminAppService.Add(admin);
        }