public void SaveEmployer(Employer employer) { Employer dbEntry = db.Employers.Find(employer.EmployerProfileId); if (dbEntry != null) { if (employer.Picture != null) { dbEntry.Picture = employer.Picture; } dbEntry.Name = employer.Name; dbEntry.Adress = employer.Adress; dbEntry.Website = employer.Website; dbEntry.LinkedIn = employer.LinkedIn; dbEntry.Email = employer.Email; dbEntry.Phone = employer.Phone; dbEntry.YearFounded = employer.YearFounded; dbEntry.Description = employer.Description; dbEntry.NumberOfEmployees = employer.NumberOfEmployees; foreach (string d in employer.Departments) { dbEntry.Departments.Add(d); } //TODO Add offers } db.SaveChanges(); }
public ActionResult Edit(Employer employer) { if (ModelState.IsValid) { employerManager.SaveEmployer(employer); return RedirectToAction("Profile"); } else { return View(employer); } }
public void AddEmployer(int userId) { Employer employer = new Employer(); employer.UserId = userId; string imageFile = Path.Combine(HttpContext.Current.Server.MapPath("~/Images/default-avatar.jpg")); byte[] buffer = File.ReadAllBytes(imageFile); employer.Picture = buffer; //TODO fill info employer.Name = "Company"; employer.Adress = "Kaspichan"; employer.Website = "http://rakiya.com/"; employer.YearFounded = 1993; employer.NumberOfEmployees = 15; db.Employers.Add(employer); db.SaveChanges(); }
public void AddEmployer(int userId, RegisterModelEmployer model) { Employer employer = new Employer(); employer.UserId = userId; string imageFile = Path.Combine(HttpContext.Current.Server.MapPath("~/Images/company-avatar.png")); byte[] buffer = File.ReadAllBytes(imageFile); employer.Picture = buffer; employer.Name = model.Name; employer.AdminEmail = model.AdminEmail; employer.EIK = model.EIK; employer.Email = model.Email; employer.Website = model.Website; employer.Address = model.Address; db.Employers.Add(employer); db.SaveChanges(); }