我有一个名为 ItemEntity 的实体类,其中有 2 列:价格和数量。我想以这样的方式添加名为 amuount 的第三列amount = rate*quantity。我是这样做的:
这是完整的实体类:
namespace Services.Common.Billing.Entities;
public class ItemEntity : BaseEntity
{
public int FeeType { get; set; }
public int FeeSchedule { get; set; }
public int FeeUnit { get; set; }
public String Description { get; set; }
public Decimal Quantity { get; set; }
[Display(Name = "Rate(US$)")]
public Decimal Rate { get; set; }
public Decimal Amount { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这是 dbContext 类:
public class BillingDbContext : …Run Code Online (Sandbox Code Playgroud) 我有一个名为 FeeNameEnum 的枚举,其中 FeeName 也由说明组成。因此,我尝试在 API 中返回 FeeName 的 FeeName 描述。这是枚举:
public enum FeeNameEnum
{
[Description("Account Opening Fee (project proponent, General Account holder, Retail Aggregation Account and End User Accoun")]
AccountOpeningFee,
}
Run Code Online (Sandbox Code Playgroud)
目前,我得到的AccountOpeningFee是 api 响应中的枚举名称。有什么方法可以获取描述而不是枚举名称?
这是我的 Dto 文件代码:
public class FeeScheduleDto
{
public Guid Id { get; set; }
public FeeNameEnum FeeName { get; set; }
public string FeeNameName { get { return FeeName.ToString(); } }
}
Run Code Online (Sandbox Code Playgroud)
任何帮助都会非常明显。
有人请帮忙!我有一个在后端创建post_type页面的插件。该插件正在创建所需的页面,但是问题是每当我尝试查看页面列表时,它都会显示“找不到页面”消息。萤幕撷取画面:http : //prnt.sc/azalub
我在此处创建所需页面的代码:
$new_page = array('post_title' => $title,
'post_content' => '['.$shortcode.']',
'post_status' => 'publish',
'post_type' => 'page'
);
$post_id = wp_insert_post( $new_page );
Run Code Online (Sandbox Code Playgroud)