public ActionResult Create(OrganisationNewModel org) { Regex rgx = new Regex("[^a-z]"); string db = rgx.Replace(org.OrganisationName.ToLower(), "") + (new Random()).Next(0, 9999).ToString(); if (ModelState.IsValid) { Organisation tempOrg = new Organisation() { Login = org.Login, Password = org.Password, DbLogin = db, DbPassword = (new Regex("[^a-zA-Z0-9]")).Replace(Cryptography.Encrypt((new Random()).Next(999, 999999).ToString()), ""), DbName = db, OrganisationName = org.OrganisationName, Address = org.Address, Email = org.Email, Phone = org.Phone }; int id = OrganisationDA.Save(tempOrg); return(RedirectToAction("Details", new { id = id })); } return(View(org)); }
public ActionResult Edit(OrganisationEditModel org) { if (ModelState.IsValid) { OrganisationDA.Save(new Organisation() { ID = org.ID, Login = org.Login, Password = org.Password, OrganisationName = org.OrganisationName, Address = org.Address, Email = org.Email, Phone = org.Phone }); return(RedirectToAction("Index")); } return(View(org)); }