コード例 #1
0
 public Enum.EntityResult CreateType(ArticleType model)
 {
     try
     {
         _db.ArticleTypes.Add(model);
         _db.SaveChanges();
         return Enum.EntityResult.Success;
     }
     catch (Exception e)
     {
         return Enum.EntityResult.Failed;
     }
 }
コード例 #2
0
 public bool _createType(ArticleType model)
 {
     if (!ModelState.IsValid)
     {
         this.AddToastMessage("", "Alanları kontrol ediniz.", Enum.ToastrType.Warning);
     }
     else
     {
         model.AuthorId = new AuthenticatedAuthor().Id;
         if (new ArticleRepository().CreateType(model) == Enum.EntityResult.Success)
         {
             this.AddToastMessage("", "Makale Tipi oluşturuldu", Enum.ToastrType.Success);
             return true;
         }
         this.AddToastMessage("", "Makale Tipi oluşturulurken hata.", Enum.ToastrType.Error);
     }
     return false;
 }