2026-05-06 10:49:33 -05:00
|
|
|
using SeaHaven.Services.DTOs;
|
|
|
|
|
|
Add LocationController with full CRUD and extended model
- Extend Locations model with Address, City, State, ZipCode, Phone, Contact, ContactEmail, Status, AccountId
- Update Location DTOs to match new fields
- Create LocationController with paged list, get by ID, create, update, delete
- Support both REST-style routes (/api/Location/{id}) and legacy query routes (/api/Location/DeleteLocation?id=)
- Add migration for new Location columns
2026-04-16 17:09:59 -04:00
|
|
|
namespace Api.SeaHavenIndustries.DTOs
|
2024-09-28 14:58:36 -04:00
|
|
|
{
|
|
|
|
|
public class EditLocation_DTO
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public string? Title { get; set; }
|
|
|
|
|
public string? Name { get; set; }
|
Add LocationController with full CRUD and extended model
- Extend Locations model with Address, City, State, ZipCode, Phone, Contact, ContactEmail, Status, AccountId
- Update Location DTOs to match new fields
- Create LocationController with paged list, get by ID, create, update, delete
- Support both REST-style routes (/api/Location/{id}) and legacy query routes (/api/Location/DeleteLocation?id=)
- Add migration for new Location columns
2026-04-16 17:09:59 -04:00
|
|
|
public string? Address { get; set; }
|
|
|
|
|
public string? City { get; set; }
|
|
|
|
|
public string? State { get; set; }
|
|
|
|
|
public string? ZipCode { get; set; }
|
|
|
|
|
public string? Phone { get; set; }
|
|
|
|
|
public string? Contact { get; set; }
|
|
|
|
|
public string? ContactEmail { get; set; }
|
|
|
|
|
public string? Status { get; set; }
|
2026-04-16 17:15:28 -04:00
|
|
|
public string? AccountId { get; set; }
|
|
|
|
|
|
|
|
|
|
public int? GetAccountId() =>
|
|
|
|
|
int.TryParse(AccountId, out var id) ? id : null;
|
2026-05-06 10:49:33 -05:00
|
|
|
|
|
|
|
|
// ✅ Map API DTO to Service DTO
|
|
|
|
|
public UpdateLocationDTO ToServiceUpdateDTO()
|
|
|
|
|
{
|
|
|
|
|
return new UpdateLocationDTO
|
|
|
|
|
{
|
|
|
|
|
LocationName = this.Name,
|
|
|
|
|
Address = this.Address,
|
|
|
|
|
City = this.City,
|
|
|
|
|
State = this.State,
|
|
|
|
|
Zipcode = this.ZipCode,
|
|
|
|
|
AccountId = this.GetAccountId()
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-09-28 14:58:36 -04:00
|
|
|
}
|
|
|
|
|
}
|