public async Task <IActionResult> Create([Bind("ReviewId,ProductName,UserName,ReviewText")] Review review) { if (ModelState.IsValid) { _context.Add(review); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(review)); }
public async Task <IActionResult> Create([Bind("Brand,Name,RyansPrice,StarPrice,StarLink,RyansLink,PicLink,Storage,Description,HddId")] HddFinal hddFinal) { if (ModelState.IsValid) { _context.Add(hddFinal); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hddFinal)); }
void HandleData() { var stbs = StbCatcher.entities.EntityList.Select(s => new { s.Lot_ID, s.ProdSpec_ID, Claim_Date = s.Claim_Time.ToString("yyyy-MM-dd"), s.Cur_Wafer_Qty }); var plans = PlanCatcher.entities.EntityList; foreach (string prod in prodList) { var entity = new ReqRpt001ProductEntity() { ProductID = prod }; var prod_stb = stbs.Where(w => w.ProdSpec_ID == prod); var prod_plan = plans.Where(w => w.ProdSpec_ID == prod); foreach (var item in Items) { int act = prod_stb.Where(w => w.Claim_Date.IndexOf(item) == 0).Sum(s => s.Cur_Wafer_Qty); int plan = prod_plan.Where(w => w.Plan_Date.IndexOf(item) == 0).Sum(s => s.Plan_Start_Pcs); entity.Plans.Add(new ReqRpt001PlanEntity() { Act = act, Plan = plan }); } var plan_total = entity.Plans.Sum(s => s.Plan); var act_total = entity.Plans.Sum(s => s.Act); if (ShowTarget) { // int days = entity.Plans.Where(w => w.Plan > 0).Count(); int days = entity.Plans.Count(); entity.OriginalTarget = days > 0 ? entity.Plans.Sum(s => s.Plan) / days:0; int leftDay = Items.Where(w => w.CompareTo(DateTime.Now.ToString("yyyy-MM-dd")) >= 0).Count(); entity.CurrentTarget = Math.Round(leftDay == 0 || plan_total < act_total ? 0 : (plan_total - act_total) / (leftDay * 1.0), 2); } entity.Plans.Add(new ReqRpt001PlanEntity { Act = act_total, Plan = plan_total }); ProductEntities.Add(entity); } }