public JsonResult Add(Employee employee) { db.Employees.Add(employee); db.SaveChanges(); return(Json(JsonRequestBehavior.AllowGet)); }
public void SaveData(Employee model) { Employee Emp = new Employee { FirstName = model.FirstName, LastName = model.LastName, Gender = model.Gender, EmailId = model.EmailId, PhoneNo = model.PhoneNo, Designation = model.Designation, ReportingManager = model.ReportingManager, Address = model.Address }; try { Db.Employees.Add(Emp); Db.SaveChanges(); Db.Dispose(); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { var v = validationError.PropertyName + "," + validationError.ErrorMessage; } } } }
public IActionResult UpdateEmployee(Guid id, [FromBody] Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employee.Guid) { return(BadRequest()); } employee.UpdateDate = DateTime.Now; _employeeContext.Entry(employee).State = EntityState.Modified; try { _employeeContext.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { if (!EmployeeExists(id)) { return(StatusCode((int)HttpStatusCode.NotFound, ex.Message)); } else { return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message)); } } return(Ok(0)); }
public IHttpActionResult PutEmployee(int id, Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employee.ID) { return(BadRequest()); } db.Entry(employee).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Generate_OLB_Shifts(List <Employee> olbTeam) { DateTime startDate = new DateTime(2015, 1, 7); DateTime endDate = new DateTime(2016, 1, 5); //int count = 0; while (startDate < endDate) { foreach (Employee person in olbTeam) { Shift again = new Shift(); again.ShiftID = shift_id++; again.EmployeeID = person.EmployeeID; again.ShiftDate = startDate;//.AddDays(count); again.ShiftPrimary = prim_or_sec; db.Entry(again).State = EntityState.Added; db.SaveChanges(); if (prim_or_sec == true) { // switch back from primary to secondary prim_or_sec = false; } else { startDate = startDate.AddDays(7); prim_or_sec = true; } } } }
public ActionResult CreateEmployee(Employee employee) { if (employee != null) { _dBContext.Add(employee); _dBContext.SaveChanges(); } return(Ok(employee)); }
public ActionResult Edit(Attendance attendance) { if (ModelState.IsValid) { db.Entry(attendance).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(attendance)); }
public ActionResult Create([Bind(Include = "id,name,surname,email,password,gender,student,worker")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "ID,Name,Abbreviation")] Currency currency) { if (ModelState.IsValid) { db.Currencies.Add(currency); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(currency)); }
public ActionResult Create([Bind(Include = "ID,FullName,Gender,DateOfBirth,PhoneNumber")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "EmployeeID,LastName,FirstName,MiddleName,Gender,BirthDate,Citizenship,Address1,Address2,City,ProvinceState,Country,PostalZip,HomePhone,MobilePhone,OfficePhone,HireDate,ContractEndDate,TerminationDate,EmergencyContactName,EmergencyContactRelationship,EmergencyContactNumber,YearsIndustryService")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "PersonId,FirstName,LastName,Gender,Email,Mobile,Landline")] Person person) { if (ModelState.IsValid) { db.Persons.Add(person); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }
public ActionResult Create([Bind(Include = "PeopleID,FirstName,LastName,Gender,PeopleContactDetail")] People people) { if (ModelState.IsValid) { db.People.Add(people); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(people)); }
public ActionResult Create([Bind(Include = "Id,Name,Age")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "ID,FirstName,LastName,HireDate,EmployeeID")] EmployeeModel employeeModel) { if (ModelState.IsValid) { db.Employees.Add(employeeModel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employeeModel)); }
public ActionResult Create([Bind(Include = "ID,Name,Abbreviation")] OverTimeStatus overTimeStatus) { if (ModelState.IsValid) { db.OverTimeStatus.Add(overTimeStatus); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(overTimeStatus)); }
public ActionResult Create([Bind(Include = "ID,Name,Abbreviation")] BudgetArea budgetArea) { if (ModelState.IsValid) { db.BudgetAreas.Add(budgetArea); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(budgetArea)); }
public ActionResult Create([Bind(Include = "ID,Name,Abbreviation")] LegalCompany legalCompany) { if (ModelState.IsValid) { db.LegalCompanies.Add(legalCompany); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(legalCompany)); }
public ActionResult Create([Bind(Include = "ID, FirstName, LastName, IDCard, Photo, Address, Phone, Birthday, Relatives, Membership, Workplace, OfficeAddress, OfficePhone, IsActiveMember, JoinDate, ExitDate")] Member member) { if (ModelState.IsValid) { db.Member.Add(member); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(member)); }
public ActionResult Create([Bind(Include = "ID,National_ID,Sex,Fname,Mname,Lname,Mobile_number,Birth_date,Address,Job_position,Is_general_manager,Is_manager,Is_supervisor")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "id,FIRSTNAME,LASTNAME,USERNAME,STARTDATE,DEPARTMENT,SALES,RATING")] EmployeeModels employeeModels) { if (ModelState.IsValid) { db.Employee.Add(employeeModels); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employeeModels)); }
public ActionResult Create([Bind(Include = "EmployeeID,EmployeeName,Designation,Salary,CreateDate")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "EmployeeID,firstName,lastName,jobTitle,birthDate,hireDate,daysFirstCall,daysSecondCall,Email")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "OrganizationID,Organization_Name,Organization_code,Is_Actv,Is_Del,Crtd_by,Crtd_ts,Mod_by,Mod_ts,RowVersion")] Organization organization) { if (ModelState.IsValid) { db.Organizations.Add(organization); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(organization)); }
public ActionResult Create([Bind(Include = "ID,Achievement_name,Achievement_description,Achievement_completion_time,Achivement_date,Achievement_status")] Achievement achievement) { if (ModelState.IsValid) { db.Achievements.Add(achievement); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(achievement)); }
public ActionResult Create([Bind(Include = "EmployeeId,FirstName,LastName,Gender,Birth,Address,Phone")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "StudentID,StudentName")] Student student) { if (ModelState.IsValid) { db.Students.Add(student); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Create([Bind(Include = "CourseID,CourseName")] Course course) { if (ModelState.IsValid) { db.Courses.Add(course); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(course)); }
public ActionResult Create([Bind(Include = "Id,Name,Location")] Department department) { if (ModelState.IsValid) { db.Departments.Add(department); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Create([Bind(Include = "ID,Name")] TrainingCategory trainingCategory) { if (ModelState.IsValid) { db.TrainingCategories.Add(trainingCategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trainingCategory)); }