Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Language,ResourceKey,ResourceText")] NsresourcesT nsresourcesT)
        {
            if (ModelState.IsValid)
            {
                _context.Add(nsresourcesT);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nsresourcesT));
        }
Example #2
0
        public async Task <IActionResult> Create(AppMonModel model)
        {
            if (ModelState.IsValid)
            {
                UserModel       userModel       = GetUserModel();
                NsapplicationsT nsapplicationsT = new NsapplicationsT
                {
                    CreatedDate = DateTime.Now,
                    Interval    = model.Interval,
                    IsActive    = true,
                    Name        = model.Name,
                    Url         = model.URL,
                    UserId      = userModel.ID
                };
                _context.Add(nsapplicationsT);
                await _context.SaveChangesAsync();
                await UpdateTempData(userModel.ID);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Example #3
0
        public async Task <IActionResult> Signup(UserModel tempModel)
        {
            if (ModelState.IsValid)
            {
                if (!tempModel.Password.Equals(tempModel.ReEnterPassword))
                {
                    ViewBag.DialogTitle   = ResourceManager.Instance.GetResource(Constants.ResourceKey.Warning);
                    ViewBag.DialogMessage = ResourceManager.Instance.GetResource(Constants.ResourceKey.PasswordsIncorrect);
                    return(View(tempModel));
                }
                NsusersT oldUserRecord = await _context.NsusersT.SingleOrDefaultAsync(entity => entity.UserName == tempModel.Username && entity.IsActive == true);

                if (oldUserRecord != null)
                {
                    ViewBag.DialogTitle   = ResourceManager.Instance.GetResource(Constants.ResourceKey.Warning);
                    ViewBag.DialogMessage = ResourceManager.Instance.GetResource(Constants.ResourceKey.UserExist);
                    return(View(tempModel));
                }
                NsusersT newUserRecord = new NsusersT
                {
                    CreatedDate = DateTime.Now,
                    IsActive    = true,
                    Password    = tempModel.Password,
                    UserName    = tempModel.Username,
                    Mail        = tempModel.Mail
                };
                _context.Add(newUserRecord);
                await _context.SaveChangesAsync();

                TempData[Constants.StateKey.DialogTitle]   = ResourceManager.Instance.GetResource(Constants.ResourceKey.Success);
                TempData[Constants.StateKey.DialogMessage] = ResourceManager.Instance.GetResource(Constants.ResourceKey.Success);
                return(RedirectToAction(nameof(Login)));
            }

            return(View(tempModel));
        }