Esempio n. 1
0
        public HttpResponseMessage CreateList(CreateListRequest request)
        {
            var response   = new CreateListResponse();
            var tempList   = new ToDoList.DomainModels.ToDoList();
            int tempUserId = _sessionManager.GetSession(request.SessionId).User.ToDoUserId;

            tempList.ListName = request.ListName;
            tempList.UserId   = tempUserId;

            if (_sessionManager.IsActive(request.SessionId))
            {
                _listManager.AddListToDatabase(tempList);
                return(Request.CreateResponse(HttpStatusCode.OK, response));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Conflict, response));
            }
        }
Esempio n. 2
0
        public ActionResult SaveList(ListFormViewModel model)
        {
            if (_sessionManager.IsActive(model.SessionId))
            {
                var tempList = new ToDoList.DomainModels.ToDoList();
                tempList.ListId   = model.ToDoList.ListId;
                tempList.ListName = model.ToDoList.ListName;
                tempList.UserId   = model.ToDoList.UserId;

                _listManager.AddListToDatabase(tempList);

                return(RedirectToAction("ListIndex", model));
            }
            else
            {
                var viewModel = new ToDoUser();
                return(RedirectToAction("SignInForm", "Auth", viewModel));
            }
        }