public JsonResult AddUser(UserData udata) { String res = ""; if (ModelState.IsValid) { String Code = Guid.NewGuid().ToString(); String Email = udata.Email.Trim(); res = adata.AddUpdateAdminUser(udata.FirstName, udata.LastName, Email, udata.Password, Code, udata.Type); if (res == "") { res = SendEmail(udata.FirstName, udata.LastName, Email, udata.Password, Code, "add_" + udata.Type); } } else { res = "Failed!"; } return(new JsonResult { Data = res, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }