Exemplo n.º 1
0
        public async Task <VotingResponse> Update(VotingRequest request)
        {
            VotingResponse response = new VotingResponse();

            try
            {
                Voting voting = new Voting();
                voting.VotingId          = request.VotingID;
                voting.VotingName        = request.VotingName;
                voting.VotingDescription = request.VotingDescription;
                voting.DueDate           = request.DueDate;
                voting.CategoryId        = request.CategoryID;
                voting.Modified          = DateTime.Now;
                voting.ModifiedBy        = request.CurrentLogin;
                if (await iVoting.Update <Voting>(voting))
                {
                    return(response);
                }
                response.Message   = "Failed to Update Voting";
                response.IsSuccess = false;
            }
            catch (Exception ex)
            {
                response.Message   = "Something Error in Our System : " + ex.Message;
                response.IsSuccess = false;
            }
            return(response);
        }
Exemplo n.º 2
0
        public async Task <VotingResponse> GetAll()
        {
            VotingResponse response = new VotingResponse();

            try
            {
                Voting voting = new Voting();
                var    query  = await iVoting.GetAll <Voting>();

                response.ListVoting = (from q in query
                                       select new VotingViewModel
                {
                    VotingId = q.VotingId,
                    CategoryId = q.CategoryId,
                    Created = q.Created,
                    DueDate = q.DueDate,
                    VotingName = q.VotingName,
                    VotingDescription = q.VotingDescription
                }).ToList();
            }
            catch (Exception ex)
            {
                response.Message   = "Something Error in Our System : " + ex.Message;
                response.IsSuccess = false;
            }
            return(response);
        }
Exemplo n.º 3
0
        public async Task <VotingResponse> GetByID(VotingRequest request)
        {
            VotingResponse response = new VotingResponse();

            try
            {
                response.Voting = await iVoting.GetByID <VotingViewModel>(request.VotingID);
            }
            catch (Exception ex)
            {
                response.Message   = "Something Error in Our System : " + ex.Message;
                response.IsSuccess = false;
            }
            return(response);
        }
Exemplo n.º 4
0
        public async Task <VotingResponse> Delete(VotingRequest request)
        {
            VotingResponse response = new VotingResponse();

            try
            {
                if (await iVoting.Delete(request.VotingID))
                {
                    return(response);
                }
                response.Message   = "Failed to Delete Voting";
                response.IsSuccess = false;
            }
            catch (Exception ex)
            {
                response.Message   = "Something Error in Our System : " + ex.Message;
                response.IsSuccess = false;
            }
            return(response);
        }