예제 #1
0
        public async Task <ActionResult> ProjectCreation(ProjectCreationBindingModel model)
        {
            var response = await _dataClient.GetProjectCategories();

            if (response.StatusIsSuccessful)
            {
                if (response.Data != null)
                {
                    model.Categories = response.Data.ToList().Select(x => new SelectListItem
                    {
                        Value = x.Id.ToString(),
                        Text  = x.Name
                    });
                }
            }
            if (!ModelState.IsValid)
            {
            }
            model.UserId = _tokenContainer.UserId.Value;
            var responseCreate = await _dataClient.Createproject(model);

            //return View(model);
            if (responseCreate.StatusIsSuccessful)
            {
                TempData["Success"] = "Added Successfully!";
            }
            else
            {
                TempData["Error"] = "Did not add project";
            }

            return(RedirectToAction("ProjectCreation", "Projects"));
        }