예제 #1
0
        public async Task <IActionResult> Create(
            long?id,
            string referer,
            string sortOrder,
            string searchString,
            int?page,
            int?pageSize,
            [Bind("Id,UserName,Password")] JwtUser item,
            string currentFilter = "")
        {
            // pass page configuration to Views
            ViewData["CurrentSort"]   = sortOrder;
            ViewData["sortOrder"]     = sortOrder;
            ViewData["searchString"]  = searchString;
            ViewData["page"]          = page;
            ViewData["pageSize"]      = pageSize;
            ViewData["currentFilter"] = currentFilter;
            item.Password             = _tokenizer.GetSHA1HashData(item.Password);
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                if (referer == null)
                {
                    return(RedirectToAction("Index"));
                }
                return(new RedirectResult(referer));
            }
            return(View(item));
        }
        public async Task <IActionResult> Create(
            long?id,
            long?contributorId,
            long?paperId,
            string referer,
            string sortOrder,
            string searchString,
            int?page,
            int?pageSize,
            [Bind("Id,Name,Description,Content,ContributorId,PaperId,Comments,AuditEntered,AuditEnteredBy,AuditUpdated,AuditUpdatedBy")] PaperVersion item,
            string currentFilter = "")
        {
            // pass page configuration to Views
            ViewData["CurrentSort"]   = sortOrder;
            ViewData["sortOrder"]     = sortOrder;
            ViewData["searchString"]  = searchString;
            ViewData["page"]          = page;
            ViewData["pageSize"]      = pageSize;
            ViewData["currentFilter"] = currentFilter;
            ViewData["contributorId"] = contributorId;
            ViewData["paperId"]       = paperId;
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                if (referer == null)
                {
                    return(RedirectToAction("Index"));
                }
                return(new RedirectResult(referer));
            }
            return(View(item));
        }
예제 #3
0
        public async Task <IActionResult> Create(
            long?id,
            string referer,
            string sortOrder,
            string searchString,
            int?page,
            int?pageSize,
            [Bind("Id,Name,Description,MyBoolean,MyCreditCard,MyCurrency,MyDateTime,MyDouble,MyEmail,MyFloat,MyImageUrl,MyInteger,MyLong,MyPhone,MyPostalCode,MyString,MyTextArea,MyTicks,MyUrl,Comments,AuditEntered,AuditEnteredBy,AuditUpdated,AuditUpdatedBy")] TestField item,
            string currentFilter = "")
        {
            // pass page configuration to Views
            ViewData["CurrentSort"]   = sortOrder;
            ViewData["sortOrder"]     = sortOrder;
            ViewData["searchString"]  = searchString;
            ViewData["page"]          = page;
            ViewData["pageSize"]      = pageSize;
            ViewData["currentFilter"] = currentFilter;
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                if (referer == null)
                {
                    return(RedirectToAction("Index"));
                }
                return(new RedirectResult(referer));
            }
            return(View(item));
        }
        public async Task <IActionResult> Create(
            long?id,
            string state,
            string sortOrder,
            string searchString,
            int?page,
            int?pageSize,
            [Bind("Id,Name,Description,Degree,AlmaMater,Email,Evaluations,Password,Comments,AuditEntered,AuditEnteredBy,AuditUpdated,AuditUpdatedBy")] Contributor item,
            string currentFilter = "")
        {
            // Manage call stack
            var stack     = new ServiceStack(state);
            var referer   = stack.GetReturnUrl();
            var callstack = state;

            // pass page configuration to Views
            ViewData["referer"]       = referer;
            ViewData["callstack"]     = callstack;
            ViewData["CurrentSort"]   = sortOrder;
            ViewData["sortOrder"]     = sortOrder;
            ViewData["searchString"]  = searchString;
            ViewData["page"]          = page;
            ViewData["pageSize"]      = pageSize;
            ViewData["currentFilter"] = currentFilter;
            item.Password             = _tokenizer.GetSHA1HashData(item.Password);
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                if (referer == null)
                {
                    return(RedirectToAction("Index"));
                }
                return(new RedirectResult(referer));
            }
            return(View(item));
        }