public HttpResponseMessage QuoteRequestEdit(QuoteRequestUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            bool isSuccessful = _QuoteRequestService.UpdateQuoteRequest(model);

            var qrUserId = UserService.GetCurrentUserId();

            var userProfile = _AdminService.ProfileGetByUserId(qrUserId);

            var qrCompanyId = userProfile.CompanyId;

            ActivityService activityService = new ActivityService();

            ActivityRequest activity = new ActivityRequest();

            activity.UserId       = qrUserId;
            activity.CompanyId    = qrCompanyId;
            activity.PrimaryId    = model.QrId.ToString();
            activity.ActivityType = ActivityType.QuoteRequest;
            activity.ActionType   = ActionType.Updated;
            activity.Name         = model.Name;

            activityService.ActivityInsert(activity);

            ItemResponse <bool> response = new ItemResponse <bool> {
                Item = isSuccessful
            };

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public HttpResponseMessage QuoteRequestInsert(QuoteRequestInsertRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            //QuoteRequestInsertRequest newQuoteRequest = new QuoteRequestInsertRequest();

            model.UserId = UserService.GetCurrentUserId();

            var userProfile = _AdminService.ProfileGetByUserId(model.UserId);

            model.CompanyId = userProfile.CompanyId;



            int quoteId = _QuoteRequestService.InsertQuoteRequest(model);

            ActivityService activityService = new ActivityService();

            ActivityRequest activity = new ActivityRequest();

            activity.UserId       = model.UserId;
            activity.CompanyId    = model.CompanyId;
            activity.PrimaryId    = quoteId.ToString();
            activity.ActivityType = ActivityType.QuoteRequest;
            activity.ActionType   = ActionType.Created;
            activity.Name         = model.Name;

            activityService.ActivityInsert(activity);



            ItemResponse <int> response = new ItemResponse <int> {
                Item = quoteId
            };

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }