Compare commits
5 Commits
cf5bb3bc7c
...
c3c740ed78
Author | SHA1 | Date |
---|---|---|
|
c3c740ed78 | |
|
22fbb522d2 | |
|
9757cbea45 | |
|
3f6c1f92ce | |
|
e3351d1934 |
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
namespace LFlow.Home.Controllers;
|
namespace LFlow.Home.Controllers;
|
||||||
public class HomeController(IHomeService<HomeDto, string> service) : BaseController
|
public class HomeController(IHomeService<HomeDto, string> service) : BaseController
|
||||||
{
|
{
|
||||||
[HttpGet("/[controller]/")]
|
[HttpGet]
|
||||||
public string Home(string id)
|
public string Home(string id)
|
||||||
{
|
{
|
||||||
return service?.GetById(id)?.ToString() ?? "No service";
|
return service?.GetById(id)?.ToString() ?? "No service";
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
using LFlow.Base.Interfaces;
|
using LFlow.Base.Interfaces;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace LFlow.Home.Models.DataModels;
|
namespace LFlow.Home.Models.DataModels;
|
||||||
|
|
||||||
|
[SugarTable("T_B_HOME")]
|
||||||
public class HomeModel : IDataModel
|
public class HomeModel : IDataModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ID
|
/// ID - GUID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "ID", IsPrimaryKey = true)]
|
||||||
public string? Id { get; set; }
|
public string? Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"HomeModel {Id}";
|
return $"HomeModel {Id}";
|
||||||
|
|
|
@ -3,10 +3,11 @@ using LFlow.Base.Interfaces;
|
||||||
|
|
||||||
// using LFlow.Interfaces;
|
// using LFlow.Interfaces;
|
||||||
using LFlow.Home.Models.DataModels;
|
using LFlow.Home.Models.DataModels;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace LFlow.Home.Repositorys;
|
namespace LFlow.Home.Repositorys;
|
||||||
|
|
||||||
public class HomeRepo : IRepo<HomeModel, string>
|
public class HomeRepo(ISqlSugarClient db) : IRepo<HomeModel, string>
|
||||||
{
|
{
|
||||||
public HomeModel Delete(string id)
|
public HomeModel Delete(string id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
|
|
||||||
using LFlow.Base.Interfaces;
|
using LFlow.Base.Interfaces;
|
||||||
|
using LFlow.Base.Interfaces.BusinessInterface;
|
||||||
|
using LFlow.User.Model.Dto;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LFlow.User.Controllers
|
namespace LFlow.User.Controllers
|
||||||
{
|
{
|
||||||
public class UserController : BaseController
|
public class UserController(IUserService<UserDto> service) : BaseController
|
||||||
{
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public string Get(string id)
|
||||||
|
{
|
||||||
|
return service?.GetById(id)?.ToString() ?? "No service";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,4 @@
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Services/" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
|
||||||
|
namespace LFlow.User.Model.DataModel;
|
||||||
|
|
||||||
|
public record UserModel : IDataModel
|
||||||
|
{
|
||||||
|
public string? UserID { get; set; }
|
||||||
|
public string? UserName { get; set; }
|
||||||
|
|
||||||
|
public string? UserNickName { get; set; }
|
||||||
|
public string? EmailAddress { get; set; }
|
||||||
|
public string? RoleId { get; set; }
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
|
||||||
|
namespace LFlow.User.Model.Dto;
|
||||||
|
|
||||||
|
public class UserDto : IModel
|
||||||
|
{
|
||||||
|
public string? UserID { get; set; }
|
||||||
|
public string? UserName { get; set; }
|
||||||
|
|
||||||
|
public string? UserNickName { get; set; }
|
||||||
|
public string? EmailAddress { get; set; }
|
||||||
|
public string? RoleId { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"UserDto [{UserID}_{UserName}_{UserNickName}_{EmailAddress}]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
using LFlow.User.Model.DataModel;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace LFlow.User.Repositorys;
|
||||||
|
|
||||||
|
public class UserRepo(ISqlSugarClient db) : IRepo<UserModel, string>
|
||||||
|
{
|
||||||
|
public UserModel Delete(string id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserModel Get(string id)
|
||||||
|
{
|
||||||
|
return new UserModel
|
||||||
|
{
|
||||||
|
UserID = id,
|
||||||
|
UserName = "Test User",
|
||||||
|
UserNickName = "Tester",
|
||||||
|
EmailAddress = "Test@Ling.chat",
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserModel SaveOrUpdate(UserModel entity, bool isUpdate)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserModel> Search(UserModel whereObj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<string> WhereSearchId(UserModel whereObj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
using LFlow.Base.Interfaces.BusinessInterface;
|
||||||
|
using LFlow.Base.Utils;
|
||||||
|
using LFlow.User.Model.DataModel;
|
||||||
|
using LFlow.User.Model.Dto;
|
||||||
|
|
||||||
|
namespace LFlow.User.Services;
|
||||||
|
|
||||||
|
public class UserService(IRepo<UserModel, string> repo) : IUserService<UserDto>
|
||||||
|
{
|
||||||
|
public UserDto DeleteById(string id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserDto GetById(string id)
|
||||||
|
{
|
||||||
|
var user = repo.Get(id);
|
||||||
|
return Mapper.Map<UserDto>(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserDto Save(UserDto entity)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserDto> Search(UserDto whereObj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,20 @@ public static class Program
|
||||||
builder.Services.AddHttpContextAccessor();
|
builder.Services.AddHttpContextAccessor();
|
||||||
builder.Services.ConfigureSqlSugar();
|
builder.Services.ConfigureSqlSugar();
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
builder.Services.AddSwaggerGen(u =>
|
||||||
|
{
|
||||||
|
u.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
|
||||||
|
{
|
||||||
|
Version = "Ver.1",
|
||||||
|
Title = "LFlow",
|
||||||
|
Description = "LFlow api test and document",
|
||||||
|
Contact = new Microsoft.OpenApi.Models.OpenApiContact
|
||||||
|
{
|
||||||
|
Name = "ling",
|
||||||
|
Email = "noemail@ling.chat"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
@ -28,7 +42,10 @@ public static class Program
|
||||||
// if (app.Environment.IsDevelopment())
|
// if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI(u =>
|
||||||
|
{
|
||||||
|
u.DocumentTitle = "LFlow";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
app.Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue