Пример #1
0
        public void AddProject()
        {
            ProjectBLL projectBLL = new ProjectBLL();

            projectBLL.CreateProject(projObj);
            Project createdproj = projectBLL.GetAll().Last();

            Assert.AreEqual(projObj.ProjectName, createdproj.ProjectName);
            Assert.AreEqual(projObj.Priority, 1);
        }
Пример #2
0
        public void CreateProject_Benchmark_Performance()
        {
            ProjectBLL projectBLL = new ProjectBLL();

            for (var i = 0; i < 100; i++)
            {
                Project projectObj = new Project();
                projectObj.ProjectName = string.Format("{0}{1}", "Project", i);
                projectObj.Status      = "New";
                projectObj.UserID      = 8616;
                projectObj.StartDate   = System.DateTime.Now;
                projectObj.EndDate     = System.DateTime.Now;
                projectBLL.CreateProject(projectObj);
            }
        }
 public IHttpActionResult Post(Project project)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ProjectBLL projectBLL = new ProjectBLL();
             projectBLL.CreateProject(project);
             return(Ok());
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception exception)
     {
         return(InternalServerError());
     }
 }
Пример #4
0
        public ActionResult Create(FormCollection collection)
        {
            string projectName = collection.Get("ProjectName");

            if (string.IsNullOrWhiteSpace(projectName))
            {
                return(View());
            }

            try
            {
                ProjectModel model = new ProjectModel();
                model.Id          = Guid.NewGuid().ToString();
                model.ProjectName = projectName;

                bll.CreateProject(model);
            }
            catch
            {
                return(View());
            }

            return(RedirectToAction("Index"));
        }