示例#1
0
        public async Task <Response> Disable(int id)
        {
            using (DietDB db = new DietDB())
            {
                Diet diet = await db.Diets.FirstOrDefaultAsync(u => u.ID == id);

                if (diet != null)
                {
                    diet.SetStatus(false);
                    await db.SaveChangesAsync();

                    return(ResponseFactory.ResponseSuccessModel());
                }
                return(ResponseFactory.ResponseNotFoundException());
            }
        }