예제 #1
0
        public async Task <IActionResult> Delete(Employee e)
        {
            try
            {
                // since the model isn't full, and we can't trust people anyway, just refetch the user
                var employee = await _repo.GetEmployeeAsync(e.ImmutableId);

                // todo: be more resilient - e.g., most of these ops should be queued off somewhere else
                await _faceProvider.DeletePersonFromPersonGroupAsync(employee.PersonGroupPersonId);

                await _blobProvider.DeleteBlobAsync(employee.PhotoPath);

                await _repo.DeleteEmployeeAsync(employee);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }