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()); }
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()); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); } }
public async Task InsertAsync(Seller obj) { _context.Add(obj); await _context.SaveChangesAsync(); }