public static bool CanEditDinner(NerdDinnerDomain.Dinner dinner) { if (HttpContext.Current.User.Identity.IsAuthenticated) { var userName = HttpContext.Current.User.Identity.Name; if (HttpContext.Current.User.IsInRole(Administrator) || ////are a dinner creator, and you are the creator if this dinner (HttpContext.Current.User.IsInRole(DinnerCreator) && dinner != null && !string.IsNullOrEmpty(dinner.CreatedBy) && userName.Equals(dinner.CreatedBy, StringComparison.OrdinalIgnoreCase))) { return true; } } return false; }
public static bool CanDeleteDinner(NerdDinnerDomain.Dinner dinner) { return CanEditDinner(dinner); }