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));
        }
Example #2
0
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        public bool UpdateQuoteRequest(QuoteRequestUpdateRequest model)
        {
            bool success = false;

            try
            {
                DataProvider.ExecuteNonQuery(GetConnection, "dbo.QuoteRequests_Update"
                                             , inputParamMapper : delegate(SqlParameterCollection paramCollection)
                {
                    paramCollection.AddWithValue("@Name", model.Name);
                    paramCollection.AddWithValue("@DueDate", model.DueDate);
                    paramCollection.AddWithValue("@Id", model.QrId);
                    paramCollection.AddWithValue("@AddressId", model.AddressId);

                    success = true;
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(success);
        }