public Task <bool> ChangePublicStatus(int id, GeneratorPublishModel model) { var pathParams = new HttpPathParameters(); pathParams.Add(id, -1); pathParams.Add("publish", -1); var settings = new HttpSettings($"{this._url}", null, pathParams, "Public status changing"); var body = new HttpBody <GeneratorPublishModel>(model); return(this._http.Update <GeneratorPublishModel>(settings, body)); }
/// <summary> /// Change public status /// </summary> /// <param name="id">Csomor Id</param> /// <param name="model">New status</param> public void ChangePublicStatus(int id, GeneratorPublishModel model) { var user = this._utils.GetCurrentUser(); var csomor = this._context.Csomors.Find(id); if (csomor == null) { throw this._logger.LogInvalidThings(user, GeneratorServiceSource, CsomorThing, CsomorDoesNotExistMessage); } csomor.IsPublic = model.Status; this._context.Update(csomor); this._context.SaveChanges(); this._logger.LogInformation(user, GeneratorServiceSource, model.Status ? "publish" : "unpublish" + " csomor", id); }
public IActionResult ChangePublicStatus([FromRoute] int id, [FromBody] GeneratorPublishModel model) { this._generatorService.ChangePublicStatus(id, model); return(this.Ok()); }