public ActionResult Save(SeeProject seeProject)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new SeeProjectFormViewModel(seeProject)
                {
                    CompanyTypes = _context.CompanyTypes.ToList()
                };
                return(View("MovieForm", viewModel));
            }
            if (seeProject.Id == 0)
            {
                seeProject.DateAdded = DateTime.Now;
                _context.SeeProjects.Add(seeProject);
            }
            else
            {
                var seeProjectInDb = _context.SeeProjects.Single(c => c.Id == seeProject.Id);
                seeProjectInDb.CompanyTypeId      = seeProject.CompanyTypeId;
                seeProjectInDb.ProjectName        = seeProject.ProjectName;
                seeProjectInDb.ProjectDescription = seeProject.ProjectDescription;
                seeProjectInDb.SkillsRequired     = seeProject.SkillsRequired;
                seeProjectInDb.Budget             = seeProject.Budget;
                seeProjectInDb.ProjectDeadline    = seeProject.ProjectDeadline;
                seeProjectInDb.ContactPerson      = seeProject.ContactPerson;
            }

            _context.SaveChanges();

            return(RedirectToAction("Index", "SeeProjects"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SeeProject seeProject = _context.SeeProjects.Find(id);

            _context.SeeProjects.Remove(seeProject);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public SeeProjectFormViewModel(SeeProject seeProject)
 {
     Id                 = seeProject.Id;
     ProjectName        = seeProject.ProjectName;
     ProjectDescription = seeProject.ProjectDescription;
     SkillsRequired     = seeProject.SkillsRequired;
     Budget             = seeProject.Budget;
     ProjectDeadline    = seeProject.ProjectDeadline;
     ContactPerson      = seeProject.ContactPerson;
     CompanyTypeId      = seeProject.CompanyTypeId;
 }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SeeProject seeProject = _context.SeeProjects.Find(id);

            if (seeProject == null)
            {
                return(HttpNotFound());
            }
            return(View(seeProject));
        }