You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using WebApiStudy.Model;
using WebApiStudy.IDal;
using WebApiStudy.IBll;
namespace WebApiStudy.Bll
{
public class UserBll : IUserBll
{
private IUserDal IDal;
public UserBll(IUserDal userDal)
{
this.IDal = userDal;
}
public List<User> GetAllUser()
{
return IDal.GetAllUser();
}
public User GetUser(int userId)
{
return IDal.GetUser(userId);
}
public (bool result, User user) InsertUser(User user)
{
return IDal.InsertUser(user);
}
public (bool result, User user) UpdateUser(User user)
{
return IDal.UpdateUser(user);
}
public bool DeleteUser(int userId)
{
int effectRow=IDal.DeleteUser(userId);
return effectRow > 0;
}
public decimal TotalIncome(int userId)
{
var user = IDal.GetUser(userId);
if (user == null)
{
return 0;
}
return user.TotalIncome();
}
public decimal TotalCost(int userId)
{
var user = IDal.GetUser(userId);
if (user == null)
{
return 0;
}
return user.TotalCost();
}
}
}