public async Task <IActionResult> Edit(string id, [Bind("spon_code,project_code,contactor,contactor_detail,id,ref_doc,support_budget,x_log,x_note,x_status")] project_supporter project_supporter) { if (id != project_supporter.spon_code) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(project_supporter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { return(NotFound()); } return(RedirectToAction("Index")); } return(View(project_supporter)); }
public async Task <IActionResult> Create(string sponsorId, string support_budget, string projectCode) { var psp = _context.project_sponsor.SingleOrDefault(pjs => pjs.id == new Guid(sponsorId)); project_supporter ps = new project_supporter(); ps.project_code = projectCode; ps.spon_code = psp.spon_code; ps.support_budget = Int32.Parse(support_budget); ps.contactor = psp.contactor; ps.contactor_detail = psp.contactor_detail; ps.x_status = psp.x_status; try { _context.Add(ps); await _context.SaveChangesAsync(); } catch (Exception) { return(Json(new { result = "fail" })); } return(Json(new { result = "success" })); }