public AuthenticatedAuthor() { Author = _db.Authors.SingleOrDefault(c => c.UserGuid == _userid); if (Author == null) return; if (Author.Picture != null) Picture = Author.Picture.File.Url; Id = Author.Id; Name = Author.Name; Surname = Author.Surname; }
public Enum.EntityResult Update(Author modified) { try { _db.Entry(modified).State = EntityState.Modified; _db.SaveChanges(); return Enum.EntityResult.Success; } catch (Exception) { return Enum.EntityResult.Failed; } }
public Enum.EntityResult Delete(Author delete) { try { _db.Authors.Remove(delete); _db.SaveChanges(); return Enum.EntityResult.Success; } catch (Exception) { return Enum.EntityResult.Failed; } }
public Enum.EntityResult Create(Author authormodel) { try { _db.Authors.Add(authormodel); _db.SaveChanges(); return Enum.EntityResult.Success; } catch (Exception e) { return Enum.EntityResult.Failed; } }
public AuthenticatedAuthor() { Author = _db.Authors.SingleOrDefault(c => c.UserGuid == _userid); if (Author == null) return; try { Picture = Author.Picture.File.Url; } catch (Exception) { Picture = null; } Id = Author.Id; Name = Author.Name; Surname = Author.Surname; }
public ActionResult Edit(Author author) { if (!ModelState.IsValid) { this.AddToastMessage("", "Alanları kontrol ediniz", Enum.ToastrType.Warning); return View(author); } var res = _author.Update(author); if (res == Enum.EntityResult.Failed) { this.AddToastMessage("", "Kullanıcı kaydedilirken hata", Enum.ToastrType.Error); return View(author); } this.AddToastMessage("", "Kayıt başarılı", Enum.ToastrType.Success); return RedirectToAction("Index"); }
public Enum.EntityResult Disable(Author disable) { disable.Active = false; return Update(disable); }