Melnar
Melnar
CC#
Created by Melnar on 6/24/2023 in #help
❔ Making charts in .net core mvc
I want to create a linechart showing daily income and expense transactions. I have created in my BLL layer a DailySummaryDto which holds the info that i want to show
public class DailySummaryDto
{
public int UserId { get; set; }
public DateTime Date { get; set; }
public decimal TotalIncome { get; set; }
public decimal TotalExpense { get; set; }
}
public class DailySummaryDto
{
public int UserId { get; set; }
public DateTime Date { get; set; }
public decimal TotalIncome { get; set; }
public decimal TotalExpense { get; set; }
}
I have also implemented a method do receive these properties
public async Task<DailySummaryDto> GetDailySummaryAsync(int userId)
{
var transactions = await _unitOfWork.TransactionRepository.GetAllDailyAsync(userId);
var totalIncome = await _unitOfWork.TransactionRepository.GetTotalIncomeAsync(transactions);
var totalExpense = await _unitOfWork.TransactionRepository.GetTotalExpenseAsync(transactions);

var dailySummaryDto = new DailySummaryDto
{
UserId = userId,
Date = DateTime.Today,
TotalIncome = totalIncome,
TotalExpense = totalExpense
};

return dailySummaryDto;
}
public async Task<DailySummaryDto> GetDailySummaryAsync(int userId)
{
var transactions = await _unitOfWork.TransactionRepository.GetAllDailyAsync(userId);
var totalIncome = await _unitOfWork.TransactionRepository.GetTotalIncomeAsync(transactions);
var totalExpense = await _unitOfWork.TransactionRepository.GetTotalExpenseAsync(transactions);

var dailySummaryDto = new DailySummaryDto
{
UserId = userId,
Date = DateTime.Today,
TotalIncome = totalIncome,
TotalExpense = totalExpense
};

return dailySummaryDto;
}
How do i display a line chart in view showing daily income and expense for the past week? Which package to install to use charts?
5 replies
CC#
Created by Melnar on 6/14/2023 in #help
❔ Entity relationship Help
I am getting started on a project using .net mvc identity and I am kinda new at this Here is how the relationship is between entities: User inherits from Identity<int> The user can create a category for a transaction The user can make multiple transactions in the same category The transaction is an expense or income Transactions of different type cannot be under the same category Now i am not sure what each class must have Should user have ICollection<Category> or ublic ICollection<Transaction> as well? What about Category Should it have ICollection<Transaction> and User User as a foreign key? What about Transaction Should it have Category Category and User User as foreign keys? I am unsure how to define the relationship between these 3 entities
7 replies
CC#
Created by Melnar on 6/10/2023 in #help
✅ Help me please
I am trying to do a project using asp.net identity. I am following n-layer mvc architecture, keeping the dal, bll and presentation layers separate connecting them with Startup classes. However the migration is not working. The project doesn't run either. Would anyone be willing to help? I can share my github.
23 replies