Beispiel #1
0
 public static void TryCreate(Account requester, DataContext context, TimeType timetype)
 {
     if (!requester.IsAtLeastManagement())
     {
         throw new ServerAuthorizeException("Du har inte behörighet att skapa tidtyp");
     }
     timetype.Validate();
     context.TimeTypes.Add(timetype);
 }
Beispiel #2
0
 public static TimeType TryUpdate(Account requester, DataContext context, TimeType dbentity)
 {
     if (!requester.IsAtLeastManagement())
     {
         throw new ServerAuthorizeException("Du har inte behörighet att uppdatera tidtyp");
     }
     dbentity.Validate();
     context.Entry(dbentity).State = System.Data.Entity.EntityState.Modified;
     return(dbentity);
 }