示例#1
0
        public void AddNewProject(NewProjectDTO newProject)
        {
            var project = new Project() {
                Title = newProject.Title,
                Description = newProject.Description,
                Budget = newProject.Budget,
                EstStart = newProject.EstStart,
                EstCompleted = newProject.EstCompleted,
                Client = new Client() {
                    Name = newProject.Client.Name,
                    PhoneNumber = newProject.Client.PhoneNumber,
                    PhoneNumber2 = newProject.Client.PhoneNumber2,
                    Email = newProject.Client.Email,
                    Description = newProject.Client.Description,
                    Location = new Location() {
                        Street1 = newProject.Client.Location.Street1,
                        Street2 = newProject.Client.Location.Street2,
                        City = newProject.Client.Location.City,
                        State = newProject.Client.Location.State,
                        Country = newProject.Client.Location.Country
                    }
                },

            };

            _projectRepo.Add(project);
            _projectRepo.SaveChanges();
        }
示例#2
0
 public IHttpActionResult Post(NewProjectDTO newProject) {
     _projectServ.AddNewProject(newProject);
     if (ModelState.IsValid && _projectServ.CheckExists(newProject.Title)) {
         return Ok();
     } else {
         return BadRequest();
     }
 }