public static Models.Department Map(this Domain.Entities.Department department) { return(new Models.Department { DepartmentId = department.DepartmentId, DepartmentName = department.DepartmentName, // DepartmentDescription = department.DepartmentDescription, DepartmentCode = department.DepartmentCode, LocationId = department.LocationId }); }
public async Task <GetDepartmentByIdDto> Handle(GetDepartmentByIdQuery request, CancellationToken cancellationToken) { GetDepartmentByIdDto getDepartmentByIdDto = new GetDepartmentByIdDto(); Domain.Entities.Department department = await _context.Departments.FirstOrDefaultAsync(u => !u.Deleted && u.Id == request.Id); if (department != null) { getDepartmentByIdDto = department.ToGetDepartmentByIdDto(); } return(getDepartmentByIdDto); }
public async Task <int> Handle(CreateDepartmentCommand request, CancellationToken cancellationToken) { var entity = new Domain.Entities.Department { Title = request.Title }; _context.Departments.Add(entity); await _context.SaveChangesAsync(cancellationToken); return(entity.Id); }
public static DepartmentViewModel ToSingleDepartmentViewModel(this Domain.Entities.Department val) { DepartmentViewModel model = new DepartmentViewModel(); if (val == null) { model = null; } else { model = new DepartmentViewModel { ID = val.ID, Name = val.Name, Active = val.Active }; } return(model); }
public UpdateDepartmentInput(Domain.Entities.Department newDepartment) => UpdatedDepartment = newDepartment;