示例#1
0
 public async Task <IActionResult> Edit(string id, [Bind("ctype_code,cgroup_code,ctype_desc,id,rowversion,x_log,x_note,x_status")] course_type course_type)
 {
     if (course_type.id != new Guid(id))
     {
         return(Json(new { result = "fail" }));
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(course_type);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!course_typeExists(course_type.ctype_code))
             {
                 return(Json(new { result = "fail" }));
             }
             else
             {
                 throw;
             }
         }
         return(Json(new { result = "success" }));
     }
     return(Json(new { result = "fail" }));
 }
示例#2
0
 public async Task <IActionResult> Create([Bind("ctype_code,cgroup_code,ctype_desc,id,rowversion,x_log,x_note,x_status")] course_type course_type)
 {
     if (ModelState.IsValid)
     {
         _context.Add(course_type);
         await _context.SaveChangesAsync();
     }
     return(Json(new { result = "success" }));
 }