Ejemplo n.º 1
0
        public async Task <HttpResponseModel> CreateUpdate(ProductModel model)
        {
            var result = await _repo.CreateUpdate(model);

            var modelForReturn = new HttpResponseModel();

            switch (result.Action)
            {
            case 1:
                modelForReturn.HttpStatusCode = _response.Created;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Created);
                modelForReturn.Remarks        = "product created";
                break;

            case 2:
                modelForReturn.HttpStatusCode = _response.Updated;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Updated);
                modelForReturn.Remarks        = "product updated";
                break;

            case -1:
                modelForReturn.HttpStatusCode = _response.Conflict;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Conflict);
                modelForReturn.Remarks        = "already exist";
                break;
            }

            return(modelForReturn);
        }
Ejemplo n.º 2
0
        public async Task <HttpResponseModel> DevHub_TimeTracking_Checkin(int bookingId, string userName)
        {
            var result = await _repo.DevHub_TimeTracking_Checkin(bookingId, userName);

            var modelForReturn = new HttpResponseModel();

            switch (result)
            {
            case -1:
                modelForReturn.HttpStatusCode = _response.NotFound;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.NotFound);
                modelForReturn.Remarks        = "booking not found.";
                break;

            case -2:
                modelForReturn.HttpStatusCode = _response.Conflict;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Conflict);
                modelForReturn.Remarks        = "already booked.";
                break;

            case -3:
                modelForReturn.HttpStatusCode = _response.Conflict;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Conflict);
                modelForReturn.Remarks        = "already checked in.";
                break;

            case 1:
                modelForReturn.HttpStatusCode = _response.Created;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Created);
                modelForReturn.Remarks        = "successfully checked-in.";
                break;

            case 2:
                modelForReturn.HttpStatusCode = _response.Accepted;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Accepted);
                modelForReturn.Remarks        = "accepted";
                break;

            case -4:
                modelForReturn.HttpStatusCode = _response.Conflict;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Conflict);
                modelForReturn.Remarks        = "schedule already booked.";
                break;

            default:
                modelForReturn.HttpStatusCode = _response.BadRequest;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.BadRequest);
                modelForReturn.Remarks        = "Error processing this request.";
                break;
            }

            return(modelForReturn);
        }
Ejemplo n.º 3
0
        public async Task <HttpResponseModel> Billing_OverallTransaction_Set(TransBillingModel model)
        {
            var result = await _repo.DevHub_Billing_OverallTransaction_Set(model);

            var modelForReturn = new HttpResponseModel();

            switch (result)
            {
            case -1:
                modelForReturn.HttpStatusCode = _response.NotFound;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.NotFound);
                modelForReturn.Remarks        = "time tracker not found.";
                break;

            case -2:
                modelForReturn.HttpStatusCode = _response.Conflict;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Conflict);
                modelForReturn.Remarks        = "amount paid is less than total bill";
                break;

            case 1:
                modelForReturn.HttpStatusCode = _response.Ok;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Ok);
                modelForReturn.Remarks        = "successfully billed out.";
                break;

            default:
                modelForReturn.HttpStatusCode = _response.BadRequest;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.BadRequest);
                modelForReturn.Remarks        = "error processing request.";
                break;
            }

            return(modelForReturn);
        }