コード例 #1
0
        public async Task <IActionResult> PutStudent(int id, Student student)
        {
            if (id != student.Id)
            {
                return(BadRequest());
            }

            _context.Entry(student).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PutItem([FromRoute] int id, [FromBody] Item item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != item.ID)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("OtsAccessId,Return,MultiAssign,DeleteOrder,ToReassign,RecreateOrder,AppraisalTagShip,MaintainTagReasons,MaintainClariReasons,AuditAdmin,DisputeQueueAccess")] OtsAccess otsAccess)
        {
            if (ModelState.IsValid)
            {
                _context.Add(otsAccess);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(otsAccess));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("UserReqId,FloorNum,CubeNum,DidNum,DualMon,RemoAcc,RemoLap,Mobile,UserStatus,UserName")] UserRequirements userRequirements)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userRequirements);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userRequirements));
        }
コード例 #5
0
ファイル: ContactsController.cs プロジェクト: BoboBH/Demo
        public async Task <IActionResult> Create([Bind("Id,Name,Address,City,State,Zip,Email,OwnerId,status")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contact);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(contact));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("VmsroleGroupId,AccountGroup,AdminSupport,Assignor,Auditor,CliServiDeptMgr,CliServiGroup,CommercialGroup,ContractorQc,Itgroup,ProcessingShippingGroup,QcsupervisorLead,Qc,SalesGroup,StatusGroup,VendorRelationsGroup")] VmsRolegroup vmsRolegroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vmsRolegroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vmsRolegroup));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("Username,Password,UserLogId")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
コード例 #8
0
        public async Task <IActionResult> Create([Bind("ID,Name")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("UserId,LastName,FirstName,Department,Office,ManagerName,IsManager,DateStart,DateEnd")] UserTable userTable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userTable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userTable));
        }
コード例 #10
0
        public async Task <IActionResult> Create([Bind("IdCategorie,Nom")] Categorie categorie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categorie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorie));
        }
コード例 #11
0
        public async Task <IActionResult> Create([Bind("IdLib,Nom,Description,IdCategorie")] Lib lib)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lib);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(lib));
        }
コード例 #12
0
ファイル: ToDoesController.cs プロジェクト: BoboBH/Demo
        public async Task <IActionResult> Create([Bind("Id,Name,IsDone,Priority")] ToDo toDo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(toDo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(toDo));
        }
コード例 #13
0
        public async Task <IActionResult> Create([Bind("ID,Nome,Checked")] Item item)
        {
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(item));
        }
コード例 #14
0
        public async Task <IActionResult> Create([Bind("Bpoid,Bpoadmin,ContractQc,FdicQc,HoldOrders,MarkOrdersShipped,QcBasic,QcPlus,QcSupervisor,ViewRules")] BpoRolegroup bpoRolegroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bpoRolegroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bpoRolegroup));
        }
コード例 #15
0
        public async Task <IActionResult> Create([Bind("LrvId,LrvAdmin,FannieQc,RegularQc,AllQueues")] LrvRolegroup lrvRolegroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lrvRolegroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(lrvRolegroup));
        }
コード例 #16
0
        public async Task <IActionResult> Create([Bind("AddiAccessId,Pci,Fdic,Crm,CopyOf")] AddiAccess addiAccess)
        {
            if (ModelState.IsValid)
            {
                _context.Add(addiAccess);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(addiAccess));
        }
コード例 #17
0
        public async Task <IActionResult> Create([Bind("ID,Title,TrailerUrl,ShortDescription,Genre,LongDescription,Actors")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
コード例 #18
0
        public async Task <IActionResult> Create([Bind("TodayDate,RequestType,RequestByName,EffectiveStart,EffectiveEnd,RequestId")] Requestinfo requestinfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(requestinfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(requestinfo));
        }
コード例 #19
0
        public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price,Rating")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
コード例 #20
0
        public async Task <IActionResult> Create([Bind("AppId,VmsroleGroup,AddAccess,Otsaccess,BporoleGroup,LrvroleGroup,Mas500Access")] Applicationaccess applicationaccess)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicationaccess);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddAccess"]    = new SelectList(_context.AddiAccess, "AddiAccessId", "AddiAccessId", applicationaccess.AddAccess);
            ViewData["BporoleGroup"] = new SelectList(_context.BpoRolegroup, "Bpoid", "Bpoid", applicationaccess.BporoleGroup);
            ViewData["LrvroleGroup"] = new SelectList(_context.LrvRolegroup, "LrvId", "LrvId", applicationaccess.LrvroleGroup);
            ViewData["Otsaccess"]    = new SelectList(_context.OtsAccess, "OtsAccessId", "OtsAccessId", applicationaccess.Otsaccess);
            ViewData["VmsroleGroup"] = new SelectList(_context.VmsRolegroup, "VmsroleGroupId", "VmsroleGroupId", applicationaccess.VmsroleGroup);
            return(View(applicationaccess));
        }
コード例 #21
0
        public IActionResult Import(IFormFile excelfile)
        {
            string   sWebRootFolder = _webHostEnvironment.WebRootPath;
            string   sFileName      = $"{Guid.NewGuid()}.xlsx";
            FileInfo file           = new FileInfo(Path.Combine(sWebRootFolder, sFileName));

            try
            {
                using (FileStream fileStream = new FileStream(file.ToString(), FileMode.Create))
                {
                    excelfile.CopyTo(fileStream);
                    fileStream.Flush();
                }
                Stream fs = excelfile.OpenReadStream();
                //此处泛型为需要隐射的实体类
                Import2Excel <FundModel> it = new Import2Excel <FundModel>();
                //这里自定义将excel的表头或列名字映射到对应实体
                it.ForMember("日期", e => e.CurrentDateTime);
                it.ForMember("上证指数", e => e.ShanghaiCompositeIndex);
                it.ForMember("平安银行(000001)", e => e.PinganBank);
                it.ForMember("贵州茅台(600519)", e => e.MoutaiChina);
                it.ForMember("中信建投(601066)", e => e.CiciCitic);
                it.ForMember("华兴源创(688001)", e => e.SuzhouHYCTechnology);
                it.ForMember("同达创业(600647)", e => e.ShanghaiTongdaVentureCapitalCo);
                //通过此方法直接将流文件加载到内存
                IList <FundModel> list = it.LoadFromExcel(fs);
                _context.AddRangeAsync(list);
                var count = _context.SaveChangesAsync();
                return(Content("上传成功,请返回到上一页进行相对收益计算!"));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
コード例 #22
0
 public async Task InsertAsync(Seller obj)
 {
     _context.Add(obj);
     await _context.SaveChangesAsync();
 }