public async Task<ActionResult> EditCircle(int circle_id, Circle circleObj) { try { //Update DB await _mLearningService.UpdateObject<Circle>(circleObj); return RedirectToAction("Index", new { id = UserID }); } catch { return RedirectToAction("Index", new { id = UserID }); } }
async void DoRegisterToCircleCommand(Circle circle) { await _mLearningService.AddUserToCircle(SessionService.GetUserId(),circle.id ); ShowViewModel<MainViewModel>(); }
async public Task<ActionResult> CreateCircle(Circle circleObj) { try { int circle_id = await _mLearningService.CreateCircle(UserID, circleObj.name, circleObj.type); //Register the Publisher as a user in a Circle await _mLearningService.CreateObject<CircleUser>(new CircleUser { Circle_id = circle_id, User_id = UserID, created_at = DateTime.UtcNow, updated_at = DateTime.UtcNow }, c => c.id); return RedirectToAction("Index", new { id = UserID }); } catch { return RedirectToAction("Index", new { id = UserID }); } }
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)); }