public void Update(PartialGrid grid) { if (!userDb.GridAllowed(User.Identity.Name, grid.Id)) throw HttpExceptionFactory.Forbidden(); if (!ModelState.IsValid) throw HttpExceptionFactory.InvalidModel(); if (!db.IsCorrectSlug(grid.Slug, grid.Id)) throw HttpExceptionFactory.BadSlug(); if(db.Exsist(grid.Id)) { db.Update(grid); } }
public void Update(PartialGrid grid) { cmd.CommandText = "EXEC UpdatePartialList @id, @slug, @title, @text, @width, @fixedwidth;"; CreateIntParameter(grid.Id, "id"); CreateTextParameter(grid.Slug, "slug"); CreateTextParameter(grid.Title, "title"); CreateTextParameter(grid.Text, "text"); CreateIntParameter(grid.Width, "width"); CreateBitParameter(grid.FixedWidth, "fixedwidth"); cmd.ExecuteNonQuery(); }