public async Task <ActionResult> Login(DtoLogin model) { var response = await ApiRequester <DtoUser> .Call("identityapi/validatelogin", "POST", postData : model); var user = response.Data; if (user != null) { var identity = new ClaimsIdentity(new[] { new Claim("Id", user.Id.ToString()), new Claim(ClaimTypes.Name, user.FullName), new Claim(ClaimTypes.Email, user.EMailAddress), new Claim(ClaimTypes.Country, "") }, "ApplicationCookie"); var ctx = Request.GetOwinContext(); var authManager = ctx.Authentication; authManager.SignIn(identity); return(Redirect((model.ReturnUrl))); } return(View(model)); }
public async Task <ActionResult> AddToDoItem(string title, int todoListId) { var dto = new DtoTodoItem { Title = title, ListId = todoListId }; var response = await ApiRequester <object> .Call("todoapi/savetodoitem", "POST", dto); return(Json(response)); }
public async Task <ActionResult> AddTodoList(string title) { var dto = new DtoTodoList { Title = title, UserId = CurrentUser.Id }; var response = await ApiRequester <object> .Call("todoapi/savetodolist", "POST", dto); return(Json(response)); }
public async Task <ActionResult> ToggleTodoItemStatus(int todoItemId) { var response = await ApiRequester <object> .Call(string.Format("todoapi/toggletodoitemstatus?todoItemId={0}", todoItemId), "POST", null); return(Json(response)); }
public async Task <ActionResult> GetTodoItems(int todoListId) { var todoItems = await ApiRequester <IEnumerable <DtoTodoItem> > .Call(string.Format("todoapi/gettodoitems?todoListId={0}", todoListId), "GET", null); return(PartialView("_TodoItems", todoItems)); }
public async Task <ActionResult> GetTodoLists() { var todoLists = await ApiRequester <IEnumerable <DtoTodoList> > .Call(string.Format("todoapi/gettodolists?userId={0}", CurrentUser.Id), "GET", null); return(PartialView("_TodoLists", todoLists)); }