public ActionResult Register(RegisterModel data) { if (ModelState.IsValid) { UsersBL ubl = new UsersBL(); if ((ubl.DoesUserNameExist(data.Username)) == true) { ViewBag.Message += "\n Username already exists"; return(View()); } if ((ubl.DoesEmailExist(data.Email)) == true) { ViewBag.Message += "\n E-mail address already exists"; return(View()); } else { ViewBag.Message = ""; ubl.AddUser(data.Role, data.Username, data.Password, data.Name, data.Surname, data.Email, data.Residence, data.Street, data.Town, data.Country); return(RedirectToAction("Login", "Login")); } } return(View()); }