public async Task<ActionResult> Circle_update([DataSourceRequest] DataSourceRequest request, circle_by_owner circle) { if (circle != null && ModelState.IsValid) { var cir = await _mLearningService.GetObjectWithId<Circle>(circle.id); cir.name = circle.name; cir.type = circle.type; cir.code = circle.code; cir.owner_id = circle.owner_id; //Update DB await _mLearningService.UpdateObject<Circle>(cir); circle = await _mLearningService.GetObjectWithId<circle_by_owner>(circle.id); } return Json(new[] { circle }.ToDataSourceResult(request, ModelState)); }
public async Task<ActionResult> Circle_destroy([DataSourceRequest] DataSourceRequest request, circle_by_owner circle) { if (circle != null && ModelState.IsValid) { await _mLearningService.DeleteObject<Circle>(new Circle { id = circle.id }); } return Json(new[] { circle }.ToDataSourceResult(request, ModelState)); }
public async Task<ActionResult> Circle_create([DataSourceRequest] DataSourceRequest request, circle_by_owner circle) { if (circle != null && ModelState.IsValid) { Circle c = new Circle { code=circle.code, institution_id = InstitutionID, name = circle.name, type = circle.type, owner_id = circle.owner_id }; int circleId = await _mLearningService.CreateCircle(c); circle = await _mLearningService.GetObjectWithId<circle_by_owner>(circleId); } return Json(new[] { circle }.ToDataSourceResult(request, ModelState)); }