示例#1
0
        public async Task <IActionResult> Add(User user)
        {
            try
            {
                user.CreatedBy = UserContext.UserID;
                user.Password  = user.Password.ToSHA512();
                await bALUser.SaveOrUpdateUserAsync(user);

                ModelState.Clear();
                ViewBag.Message     = user.UserID > 0 ? "User Info Updated Successfully." : "User Info Added Successfully.";
                ViewBag.MessageType = "success";
            }
            catch
            {
                ViewBag.Message     = "Error while saving user info. Please contact sytem administrator.";
                ViewBag.MessageType = "error";
            }
            await LoadUserRoles();
            await LoadVehicleNoAsync();

            return(View());
        }