Exemplo n.º 1
0
        public List <ViewInterestedClass> GetClassId(int UserId)
        {
            List <InterestedClass> list = _repository.GetClassId(UserId);

            List <ViewInterestedClass> model = new List <ViewInterestedClass>();

            foreach (var item in list)
            {
                model.Add(ViewInterestedClass.ToViewModel(item));
            }
            return(model);
        }
Exemplo n.º 2
0
 public int Add(ViewInterestedClass interested)
 {
     if (Exists(interested.ClassId, interested.UserId))
     {
         return(Delete(interested.ClassId, interested.UserId));
     }
     else
     {
         interested.CreateTime = DateTime.Now;
         InterestedClass ic = _repository.Add(ViewInterestedClass.ToEntity(interested));
         return(ic.Id);
     }
 }
Exemplo n.º 3
0
        public JsonResult AddInterest(int classId)
        {
            ViewInterestedClass   model  = new ViewInterestedClass();
            InterestServiceClient client = new InterestServiceClient();

            if (client.Exists(classId, user.Uid))
            {
                model.Id = client.Delete(classId, user.Uid);
            }
            else
            {
                model.ClassId = classId;
                model.UserId  = user.Uid;
                model.Id      = client.Add(model);
            }
            InterestServiceClient interestClient = new InterestServiceClient();
            int GetCount = interestClient.ClassInterests(classId, 1, 10).RecordCount;

            return(Json(new { code = GetCount }));
        }
Exemplo n.º 4
0
 public int Add(ViewInterestedClass interested)
 {
     return(Impl.Add(interested));
 }
Exemplo n.º 5
0
 public ViewInterestedClass GetById(int id)
 {
     return(ViewInterestedClass.ToViewModel(_repository.Get(id)));
 }