public void MaidTrackingIssue(ApartmentEmployeeModel model)
        {
            if (Request.Headers.TryGetValues("Token", out var values))
            {
                var token      = values.First();
                var tokenModel = JsonConvert.DeserializeObject <TokenModel>(Encrypt.Base64Decode(token));
                var maid       = _service.GetActiveMaidById(tokenModel.Id);
                if (Equals(maid, null))
                {
                    ExceptionContent(HttpStatusCode.Unauthorized, "err_account_not_found");
                }

                var apartmentEmployee =
                    _service.GetLastApartmentEmployeeByApartmentIdAndEmployeeId(model.ApartmentId, maid.employee_id);
                apartmentEmployee.check_out_time = ConvertDatetime.GetCurrentUnixTimeStamp();
                apartmentEmployee.check_out_geo  = JsonConvert.SerializeObject(model.CheckOutGeo);
                apartmentEmployee.type           = model.Type;
                _service.SaveApartmentEmployee(apartmentEmployee);

                var apartmentIssues =
                    _service.GetListApartmentEmployeeIssueByApartmentEmployeeId(apartmentEmployee
                                                                                .apartment_employee_id);
                foreach (var item in apartmentIssues)
                {
                    _service.DeleteApartmentEmployeeIssue(item);
                }

                var listIssue = new List <apartment_employee_issue>();
                foreach (var item in model.ListIssue)
                {
                    var issue = new apartment_employee_issue
                    {
                        apartment_employee_id = apartmentEmployee.apartment_employee_id,
                        issue_id = item.IssueId,
                        apartment_employee_issue_id = 0,
                        is_complete = item.IsComplete
                    };
                    listIssue.Add(issue);
                }
                _service.SaveListApartmentEmployeeIssue(listIssue);
            }
        }
 public void DeleteApartmentEmployeeIssue(apartment_employee_issue item)
 {
     ApartmentEmployeeIssueRepository.Delete(item);
 }