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); }
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); } }
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 })); }
public int Add(ViewInterestedClass interested) { return(Impl.Add(interested)); }
public ViewInterestedClass GetById(int id) { return(ViewInterestedClass.ToViewModel(_repository.Get(id))); }