示例#1
0
 public NewMenuSoft.Models.ResponseModel Create(Models.CategoryTbl category)
 {
     using (var unitOfWork = new UnitOfWork(new MenuSoftDbContext()))
     {
         unitOfWork.CategoryTbl.Create(category);
         try
         {
             return(new NewMenuSoft.Models.ResponseModel
             {
                 Status = NewMenuSoft.Helper.Enum.ResponseMessage.Success
             });
         }
         catch (Exception ex)
         {
             return(new NewMenuSoft.Models.ResponseModel
             {
                 Status = NewMenuSoft.Helper.Enum.ResponseMessage.Fail,
                 Message = ex.Message
             });
         }
     }
 }
示例#2
0
 public NewMenuSoft.Models.ResponseModel Delete(Models.CategoryTbl category)
 {
     using (var unitOfWork = new UnitOfWork(new MenuSoftDbContext()))
     {
         unitOfWork.CategoryTbl.Delete(category);
         try
         {
             unitOfWork.SaveChanges();
             return(new ResponseModel
             {
                 Status = ResponseMessage.Success
             });
         }
         catch (Exception ex)
         {
             return(new ResponseModel
             {
                 Status = ResponseMessage.Fail,
                 Message = ex.Message
             });
         }
     }
 }