Example #1
0
 public static Crowd ConvertCrowdDTOCToDAL(CrowdDTO crowd)
 {
     return(new Crowd
     {
         nameCrowd = crowd.nameCrowd
     });
 }
Example #2
0
 public static bool addCrowd(CrowdDTO c)
 {
     using (libraryEntities db = new libraryEntities())
     {
         db.Crowds.Add(Converters.CrowdConverter.ConvertCrowdDTOCToDAL(c));
         try
         {
             db.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Example #3
0
        public static bool updateCrowd(CrowdDTO a)
        {
            using (libraryEntities db = new libraryEntities())
            {
                Crowd b = db.Crowds.First(x => x.codeCrowd == a.codeCrowd);
                b.nameCrowd = a.nameCrowd;

                try
                {
                    db.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Example #4
0
 public IHttpActionResult UpdateCrowd(CrowdDTO crowd)
 {
     return(Ok(BL.crowdBL.updateCrowd(crowd)));
 }
Example #5
0
 public IHttpActionResult AddCrowd(CrowdDTO crowd)
 {
     return(Ok(BL.crowdBL.addCrowd(crowd)));
 }