private void ResetRow(EmployeeDto oldEmployee) { int index = Employees.IndexOf(SelectedEmployee); Employees.Remove(SelectedEmployee); Employees.Insert(index, oldEmployee); SelectedEmployee = oldEmployee; }
public IHttpActionResult GetLoggedCourierData() { var id = User.Identity.GetUserId(); var employee = context.Employees.FirstOrDefault(e => e.User.Id == id); var result = new EmployeeDto(); Mapper.Map(employee, result, typeof(Employee), typeof(EmployeeDto)); return Ok(result); }
/// <summary> /// Zwraca dane pracownika o podanym identyfikatorze /// </summary> /// <param name="id">Id pracownika</param> /// <returns>Dane pracownika</returns> public IHttpActionResult Get(int id) { var employee = context.Employees.Find(id); if (employee == null) { return NotFound(); } var result = new EmployeeDto(); Mapper.Map(employee, result, typeof(Employee), typeof(EmployeeDto)); return Ok(result); }
/// <summary> /// Zmienia dane pracownika /// </summary> /// <param name="employee"></param> /// <returns></returns> public IHttpActionResult Put(EmployeeDto employee) { var oldEmployee = context.Employees.Find(employee.Id); if (oldEmployee == null) { return NotFound(); } Mapper.Map(employee, oldEmployee); context.SaveChanges(); return Ok(); }
/// <summary> /// Wczytuje dane zalogowanego użytkownika /// </summary> public async void GetLoggedEmployeeData() { Employee = await service.GetLoggedData(); }
/// <summary> /// Aktualizuje pracownika. /// </summary> /// <param name="employee"></param> /// <returns></returns> public async Task UpdateEmployee(EmployeeDto employee) { await Put(employee); }