public void AddLikesTest() { var proposal1 = _repository.Get(1); var data = _repository.AddLikes(proposal1.Id); var proposal2 = _repository.Get(1); Assert.IsTrue(data); Assert.IsTrue((proposal2.Likes - proposal1.Likes) == 1); }
public new Proposal Update(Proposal obj) { var proposal = _proposalRepository.Get(x => x.Id == obj.Id); if (proposal == null) { throw new Exception("Não foi possível atualizar, proposta não encontrada"); } proposal.VehicleId = obj.VehicleId; proposal.Amount = obj.Amount; proposal.Client = obj.Client; proposal.DateProposal = obj.DateProposal; return(_proposalRepository.Update(proposal)); }
public ActionResult Index() { HttpContext.Session.SetBoolean("IndexStudent", false); HttpContext.Session.SetBoolean("IndexUser", false); Lecturer lecturer = _lecturerctx.GetLecturer(User.Identity.Name.ToString().Substring(1, User.Identity.Name.ToString().Length - 1)); int courseId = HttpContext.Session.GetInt32(CID) ?? default(int); if (User.IsInRole("Admin")) { IEnumerable <ProposalViewModel> proposals = _proposalctx.Get(lecturer); HttpContext.Session.SetBoolean("IndexExternal", true); return(View("~/Views/_Admin/Proposal/Index.cshtml", proposals)); } else { Debug.WriteLine(lecturer.lecturer_id); IEnumerable <ProposalViewModel> proposals = _proposalctx.GetForLecturer(lecturer); return(View("~/Views/_Lecturer/Proposal/Index.cshtml", proposals)); } }
public ServiceResult ListProposals([FromServices] IProposalRepository proposalRepository) { var result = proposalRepository.Get(); return(Mapper.Map <List <ProposalViewModel> >(result).AsServiceResultWithEntity().SetValid()); }
public async Task <ProposalModel> Get(int proposalId) { return(await repo.Get(proposalId)); }