Classe responsável por representar um PETiano
Наследование: BaseEntity
Пример #1
0
        public ActionResult Create(PETiano petiano)
        {
            petiano.Password = Crypto.HashPassword(petiano.Password);
            _PETianoService.CreatePETiano(petiano);

            return RedirectToAction("Index");
        }
        public ActionResult Create(PETiano petiano, string profile)
        {
            if (string.IsNullOrEmpty(petiano.Cpf) || string.IsNullOrEmpty(petiano.Rg) ||
                string.IsNullOrEmpty(petiano.Email) || string.IsNullOrEmpty(petiano.Name) || string.IsNullOrEmpty(petiano.Login) ||
                string.IsNullOrEmpty(petiano.Password) || string.IsNullOrEmpty(petiano.CellPhone))
            {
                _PopulateDropdown();
                return View();
            }

            petiano.Password = Crypto.HashPassword(petiano.Password);

            if (petiano.PhotoFile != null)
            {
                using (MemoryStream target = new MemoryStream())
                {
                    petiano.PhotoFile.InputStream.CopyTo(target);
                    petiano.Photo = target.ToArray();
                }
            }

            petiano.Profile = Extension.GetValueFromDescription<EProfile>(profile);

            _SendEmailProfile(Extension.GetValueFromDescription<EProfile>(profile), false);

            _PETianoService.CreatePETiano(petiano);

            return RedirectToAction("Index");
        }
Пример #3
0
 public ActionResult Index(PETiano user)
 {
     if (_IsValid(user.Login, user.Password))
     {
         FormsAuthentication.SetAuthCookie(user.Login, false);
         return RedirectToAction("Index", "PETiano");
     }
     else
     {
         ViewData[Localization.Global.Error.LoginFail] = Localization.Global.Error.LoginFail;
         return View(user);
     }
 }
        public ActionResult Edit(PETiano petiano, string profile)
        {
            if (string.IsNullOrEmpty(petiano.Name) || string.IsNullOrEmpty(petiano.Login) || string.IsNullOrEmpty(petiano.Password))
            {
                PETianoFilter petianoFilter = new PETianoFilter()
                {
                    Id = petiano.Id
                };

                PETiano ptn = _PETianoService.GetPETiano(petianoFilter);

                if (ptn == null)
                    return View();

                ptn.Password = string.Empty;

                _PopulateDropdown(ptn.Profile.GetDescription());

                return View(ptn);
            }

            petiano.Password = Crypto.HashPassword(petiano.Password);

            if (petiano.PhotoFile != null)
            {
                using (MemoryStream target = new MemoryStream())
                {
                    petiano.PhotoFile.InputStream.CopyTo(target);
                    petiano.Photo = target.ToArray();
                }
            }

            petiano.Profile = Extension.GetValueFromDescription<EProfile>(profile);

            _SendEmailProfile(Extension.GetValueFromDescription<EProfile>(profile), true);

            this._PETianoService.EditPETiano(petiano);

            return RedirectToAction("Index");
        }
 public void EditPETiano(PETiano petiano)
 {
     using (IDataProvider provider = base.CreateDataProvider())
     using (IPETianoRepository repository = provider.CreatePETianoRepository())
         repository.Update(petiano);
 }
Пример #6
0
 public void EditPETiano(PETiano petiano)
 {
     using (IBusinessProvider provider = base.CreateBusinessProvider())
     using (IPETianoBusinessProvider prov = provider.CreatePETianoBusinessProvider())
         prov.EditPETiano(petiano);
 }
Пример #7
0
        public ActionResult Delete(PETiano petiano)
        {
            _PETianoService.DeletePETiano(petiano);

            return RedirectToAction("Index");
        }