public async Task <bool> DeleteEmploymentApplicationAsync(string id)
        {
            try
            {
                var employmentApplicationList = await ReadEmploymentApplicationData();

                if (employmentApplicationList.Any())
                {
                    EmploymentApplication model = new EmploymentApplication();
                    var existModel = employmentApplicationList.FirstOrDefault(x => x.Id == id);

                    if (existModel != null)
                    {
                        model = existModel;
                        employmentApplicationList.Remove(existModel);
                    }

                    model.IsDeleted = true;
                    employmentApplicationList.Add(model);
                }

                return(await WriteEmploymentApplicationData(employmentApplicationList));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <bool> UpdateEmploymentApplicationAsync(EmploymentApplication model)
        {
            try
            {
                var employmentApplicationViewModelList = await ReadEmploymentApplicationData();

                if (employmentApplicationViewModelList.Any())
                {
                    var existModel = employmentApplicationViewModelList.FirstOrDefault(x => x.Id == model.Id);

                    if (existModel != null)
                    {
                        employmentApplicationViewModelList.Remove(existModel);
                    }

                    employmentApplicationViewModelList.Add(model);
                }

                return(await WriteEmploymentApplicationData(employmentApplicationViewModelList));
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#3
0
 public async Task <int> UpdateEmploymentApplicationAsync(EmploymentApplication model)
 {
     if (!string.IsNullOrEmpty(model.Id))
     {
         _context.EmploymentApplications.Update(model);
     }
     return(await _context.SaveChangesAsync());
 }
示例#4
0
 public async Task <int> InsertOrUpdatetEmploymentApplicationAsync(EmploymentApplication model)
 {
     if (string.IsNullOrEmpty(model.Id))
     {
         model.Id = Guid.NewGuid().ToString();
         await _context.EmploymentApplications.AddAsync(model);
     }
     else
     {
         _context.EmploymentApplications.Update(model);
     }
     return(await _context.SaveChangesAsync());
 }
        public async Task <EmploymentApplication> GetEmploymentApplicationAsync(string id)
        {
            try
            {
                EmploymentApplication employmentApplicationViewModel = new EmploymentApplication();
                var employmentApplicationList = await ReadEmploymentApplicationData();

                employmentApplicationViewModel = employmentApplicationList.FirstOrDefault(x => x.Id == id);
                return(employmentApplicationViewModel);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#6
0
 public async Task <int> InsertEmploymentApplicationAsync(EmploymentApplication model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.Id))
         {
             model.Id = Guid.NewGuid().ToString();
             await _context.EmploymentApplications.AddAsync(model);
         }
         return(await _context.SaveChangesAsync());
     }
     catch (Exception)
     {
         throw;
     }
 }
        public async Task <bool> InsertEmploymentApplicationAsync(EmploymentApplication model)
        {
            try
            {
                model.Id = Guid.NewGuid().ToString();

                var employmentApplicationList = await ReadEmploymentApplicationData();

                if (employmentApplicationList.Any())
                {
                    employmentApplicationList.Add(model);
                }

                return(await WriteEmploymentApplicationData(employmentApplicationList));
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#8
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new EmploymentApplication();
 }