public User Create(User item) { var createOrganizationentity = _context.Users.Add(item).Entity; _context.SaveChanges(); return(createOrganizationentity); }
public Enterprise Create(Enterprise item) { var createEnterprisesentity = _context.Enterprises.Add(item).Entity; _context.SaveChanges(); return(createEnterprisesentity); }
public Country Create(Country item) { var createCountryentity = _context.Сountries.Add(item).Entity; _context.SaveChanges(); return(createCountryentity); }
public Family Create(Family item) { var createFamilyentity = _context.Familys.Add(item).Entity; _context.SaveChanges(); return(createFamilyentity); }
public Department Create(Department item) { var createDepartmententity = _context.Departments.Add(item).Entity; _context.SaveChanges(); return(createDepartmententity); }
public Offering Create(Offering item) { var createOfferingentity = _context.Offerings.Add(item).Entity; _context.SaveChanges(); return(createOfferingentity); }
public Organization Create(Organization item) { var createOrganizationentity = _context.Organizations.Add(item).Entity; _context.SaveChanges(); return(createOrganizationentity); }
public Business Create(Business item) { var createBusinessentity = _context.Businesses.Add(item).Entity; _context.SaveChanges(); return(createBusinessentity); }
public ActionResult Edit(Enterprises enterprise) { if (Request.IsAjaxRequest()) { db.Entry(enterprise).State = EntityState.Modified; db.SaveChanges(); return(Content("<b>Дані збережені о <b>" + DateTime.Now.ToLongTimeString())); } return(RedirectToAction("List")); }
public ActionResult Create([Bind(Include = "ID,Name,Description,DateCreated")] Enterprise enterprise) { if (ModelState.IsValid) { db.Enterprises.Add(enterprise); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(enterprise)); }
public ActionResult Create([Bind(Include = "ID,Name,Description,EnterpriseID")] Competence competence) { if (ModelState.IsValid) { db.Competences.Add(competence); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EnterpriseID = new SelectList(db.Enterprises, "ID", "Name", competence.EnterpriseID); return(View(competence)); }
public ActionResult Create([Bind(Include = "ID,Name,DateModified,DateCreated")] Client client) { if (ModelState.IsValid) { client.DateCreated = DateTime.Now; client.DateModified = DateTime.Now; db.Clients.Add(client); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(client)); }
public MembershipUser CreateUser(string email, string password) { MembershipUser membershipUser = GetUser(email, false); if (membershipUser == null) { try { using (EnterpriseContext _db = new EnterpriseContext()) { User user = new User(); user.Email = email; user.Password = Crypto.HashPassword(password); user.CreationDate = DateTime.Now; if (_db.Roles.Find(2) != null) { user.RoleId = 2; } _db.Users.Add(user); _db.SaveChanges(); membershipUser = GetUser(email, false); return(membershipUser); } } catch { return(null); } } return(null); }
public ActionResult Create([Bind(Include = "ID,ClientID,ParentID,AccessCode,IsAndroid,ApkName,Route,Enabled,DateModified,DateCreated,DownloadCount")] Enterprise enterprise) { if (ModelState.IsValid) { // avoiding null value DateTime exception enterprise.DateCreated = DateTime.Now; enterprise.DateModified = DateTime.Now; db.Enterprises.Add(enterprise); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClientID = new SelectList(db.Clients, "ID", "Name", enterprise.ClientID); ViewBag.ParentID = new SelectList(db.Parents, "ID", "Name", enterprise.ParentID); return(View(enterprise)); }
public ActionResult Create([Bind(Include = "ID,Name,Surname,Email,PhoneNr,RegistrationDate,EnterpriseID")] Employee employee) { if (ModelState.IsValid) { int?result = ToNullableInt32(Request.Form["CompetenceID"]); var competenceRating = new CompetenceRating { CompetenceID = result, EmployeeID = employee.ID }; db.CompetencesRatings.Add(competenceRating); db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EnterpriseID = new SelectList(db.Enterprises, "ID", "Name", employee.EnterpriseID); return(View(employee)); }
public override void CreateRole(string roleName) { Role newRole = new Role() { Name = roleName }; EnterpriseContext db = new EnterpriseContext(); db.Roles.Add(newRole); db.SaveChanges(); }
public ActionResult Create([Bind(Include = "ID,EmployeeID,CompetenceID,Grade,DateCreated")] CompetenceRating competenceRating) { if (ModelState.IsValid) { var temp = db.CompetencesRatings.Where(e => e.EmployeeID == competenceRating.EmployeeID).FirstOrDefault(); //if (temp != null ) //{ // temp.CompetenceID = competenceRating.CompetenceID; // temp.Grade = competenceRating.Grade; // db.Entry(temp).State = EntityState.Modified; // db.SaveChanges(); //} else //{ competenceRating.DateCreated = DateTime.Now; db.CompetencesRatings.Add(competenceRating); db.SaveChanges(); // } return(RedirectToAction("Index")); } ViewBag.CompetenceID = new SelectList(db.Competences, "ID", "Name", competenceRating.CompetenceID); ViewBag.EmployeeID = new SelectList(db.Employees, "ID", "Name", competenceRating.EmployeeID); return(View(competenceRating)); }
public void Add(T entity) { _context.Set <T>().Add(entity); _context.SaveChanges(); }
public static void EnsureSeedData(this EnterpriseContext context) { if (context.Enterprises.Any()) { return; } context.Enterprises.Add(new Enterprise { Name = "Enterprise", Organizations = new List <Organization> { new Organization { Name = "Organization", Countries = new List <Country> { new Country { Name = "Ukraine", Businesses = new List <Business> { new Business() { Name = "GIS", Families = new List <Family> { new Family { Name = "Cloud", Offerings = new List <Offering> { new Offering { Name = "Cloud Compute", Departments = new List <Department> { new Department { Name = "Department C", Users = new List <User> { new User { Name = "Ivan" } } } } } } } } } } } } } } }); context.SaveChanges(); }
public void Save() { db.SaveChanges(); }