Esempio n. 1
0
 public ReturnValue<bool> DeleteAlbum(T_Album iAlbum)
 {
     try
     {
         _dataContext.T_Album.Remove(iAlbum);
         _dataContext.SaveChanges();
         return new ReturnValue<bool>(true, "");
     }
     catch (Exception)
     {
         return new ReturnValue<bool>(false, "");
     }
 }
Esempio n. 2
0
 public ReturnValue<bool> AddNewAlbum(T_Album iAlbum)
 {
     if (IsExist(iAlbum)) return new ReturnValue<bool>(false, "Mục đã tồn tại");
     try
     {
         iAlbum.Slug = TNVTH.Web.Utilities.Common.ToUrlSlug(iAlbum.Title);
         _dataContext.T_Album.Add(iAlbum);
         _dataContext.SaveChanges();
         return new ReturnValue<bool>(true, "");
     }
     catch (Exception)
     {
         return new ReturnValue<bool>(false, "");
     }
 }
Esempio n. 3
0
        public ActionResult AddNew(T_Album iAlbum)
        {
            ReturnValue<bool> result = new ReturnValue<bool>(false, "");

            if (ModelState.IsValid)
            {
                result = _service.AddNewAlbum(iAlbum);
            }
            if (result.RetValue)
            {
                return RedirectToAction("List", "Album");
            }
            else
            {
                // Get Album_List again
                ModelState.AddModelError("Error", result.Msg);
                return View(iAlbum);
            }
        }
Esempio n. 4
0
 public ActionResult Edit(T_Album iAlbum)
 {
     ReturnValue<bool> result = _service.UpdateAlbum(iAlbum);
     if (result.RetValue)
     {
         return RedirectToAction("List", "Album");
     }
     else
     {
         // Get Album_List again
         ModelState.AddModelError("Error", result.Msg);
         return View(iAlbum);
     }
 }
Esempio n. 5
0
 public T_Album AddNewAlbumAndReturn(T_Album iAlbum)
 {
     _dataContext.T_Album.Add(iAlbum);
         _dataContext.SaveChanges();
         return iAlbum;
 }
Esempio n. 6
0
 public ReturnValue<bool> UpdateAlbum(T_Album iAlbum)
 {
     //if (IsExist(iAlbum)) return new ReturnValue<bool>(false, "Mục đã tồn tại");
     try
     {
         _dataContext.Entry(iAlbum).State = EntityState.Modified;
         return new ReturnValue<bool>(_dataContext.SaveChanges() > 0, "");
     }
     catch (Exception)
     {
         return new ReturnValue<bool>(false, "");
     }
 }
Esempio n. 7
0
 public bool IsExist(T_Album iAlbum)
 {
     return false;
 }