Пример #1
0
        public async Task <ActionResult> Add(FormAdd formAdd)
        {
            if (ModelState.IsValid)
            {
                formAdd.Password = HelperWorkWithData.GetHash(formAdd.Password);
                await HelperConnect.AddPeople(formAdd);

                return(RedirectToAction("MainForm", "Home"));
            }
            ViewData["Layout"] = "";
            return(View(formAdd));
        }
        public async Task <ActionResult> Add(FormAdd formAdd)
        {
            var isFind = await manager.FindEmail(formAdd.Email);

            if (isFind)
            {
                ModelState.AddModelError("Email", Resource["EmailIsBusy"]);
            }
            else if (ModelState.IsValid)
            {
                formAdd.Password = helperWork.GetHash(formAdd.Password);
                await manager.AddPeople(formAdd);

                return(RedirectToAction("Index", "Home"));
            }
            await WriteLangsToViewBag();

            return(View(formAdd));
        }