Пример #1
0
 private void Save(Models.Person record, bool isNew)
 {
     // add any code to update other fields/tables here
     if (Request["pwValue"] + "" != "")
     {
         record.Password = Security.CreateSecuredPassword(Request["pwValue"]);
     }
     if (record.Password.IsBlank())
     {
         // Person MUST have a password
         record.Password = Beweb.RandomPassword.Generate(8);;
     }
     record.Save();
     PersonCache.Rebuild();
 }
Пример #2
0
        /// <summary>
        /// Deletes the given record or displays validation errors if cannot delete
        /// GET: /Admin/Person/Delete/5
        /// </summary>
        public ActionResult Delete(int id, string returnPage)
        {
            var    record = Models.Person.LoadID(id);
            string issues = record.CheckForDependentRecords();

            if (issues != null)
            {
                Web.ErrorMessage = "Cannot delete this record. " + issues; return(RedirectToEdit(record.ID));

                return(View("PersonEdit"));
            }
            //record.Deals.DeleteAll();
            record.Delete();
            PersonCache.Rebuild();
            return(Redirect(returnPage));
        }