private async Task SetState(Status status) { if ((Status)Model.State == status) { return; } Model.State = (int)status; int effects = await _db.SaveChangesAsync(); if (effects == 1) { return; } throw new Exception("scream set status fail"); }
/// <summary> /// Increase comment hidden count /// </summary> /// <returns></returns> public async Task <int> IncreaseHidden() { Model.HiddenCount++; _db.Comments.Update(Model); int effect = await _db.SaveChangesAsync(); if (effect == 1) { return(Model.HiddenCount); } throw new Exception("Increase comment hidden count fail"); }