28 lines
682 B
C#
28 lines
682 B
C#
using OFBButte.Application.Database;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace OFBButte.Application.Users
|
|
{
|
|
public class DeleteUser
|
|
{
|
|
private readonly IOFBContext context;
|
|
public DeleteUser(IOFBContext context)
|
|
{
|
|
this.context = context;
|
|
}
|
|
public void Handle(string email)
|
|
{
|
|
// Get the user
|
|
var user = context.Users.FirstOrDefault(u => u.Email == email && u.DeletedDate == null);
|
|
if (user == null)
|
|
return;
|
|
|
|
user.DeletedDate = DateTime.Now;
|
|
context.SaveChanges();
|
|
}
|
|
}
|
|
}
|