Ejemplo n.º 1
0
        public IActionResult UpdateWebsiteDataById([FromRoute] string schemaid, [FromRoute] string clientid, [FromBody] UpdateWebsiteDataRequestModel requestModel)
        {
            ///TODO : Chheck that mongodb driver support long for skip and limit
            // string userid = Request.Headers.Authorization.ToString();
            // command.UserId = userid;
            try
            {
                if (string.IsNullOrEmpty(clientid) || BasePluginConfigGenerator.GetBasePlugin(clientid).GetClientId() != clientid.Trim().ToUpper())
                {
                    return(new CommonActionResult(CommonAPIResponse.UnAuthorized()));
                }

                requestModel.SchemaId = schemaid;
                // requestModel.SchemaName = schemaname.ToUpper();
                var validationResult = requestModel.Validate();
                if (validationResult.Any())
                {
                    return(BadRequest(validationResult));
                }

                return(new CommonActionResult(MongoConnector.UpdateWebsiteData(requestModel)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Ejemplo n.º 2
0
        public IActionResult UpdateWebsiteData([FromRoute] string schemaname, [FromBody] UpdateWebsiteDataRequestModel requestModel)
        {
            ///TODO : Chheck that mongodb driver support long for skip and limit
            // string userid = Request.Headers.Authorization.ToString();
            // command.UserId = userid;
            try
            {
                var userId = AuthHelper.AuthorizeRequest(Request);
                if (string.IsNullOrEmpty(userId))
                {
                    return(new CommonActionResult(CommonAPIResponse.UnAuthorized()));
                }
                else
                {
                    requestModel.UserId = userId;
                }

                requestModel.SchemaName = schemaname;
                // requestModel.SchemaName = schemaname.ToUpper();
                var validationResult = requestModel.Validate();
                if (validationResult.Any())
                {
                    return(BadRequest(validationResult));
                }

                return(new CommonActionResult(MongoConnector.UpdateWebsiteData(requestModel)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }