Ejemplo n.º 1
0
 /// <summary>
 /// Find Location by Location ID
 /// </summary>
 /// <param name="id">Location ID</param>
 /// <returns>Location object</returns>
 public Location Find(int id)
 {
     Location loc = new Location();
     List<Location> locs = db.Locations.Where(l => l.ID == id).ToList();
     if (locs.Count == 1)
     {
         loc = locs[0];
     }
     else
     {
         throw new Exception("Not Found");
     }
     return loc;
 }
Ejemplo n.º 2
0
 public ResultInfo.Result Add(string title)
 {
     try
     {
         Location loc = new Location();
         loc.GUID = Guid.NewGuid();
         loc.Title = title;
         loc.isActive = false;
         loc.Status = 1;
         loc.IconID = 1;
         loc.LatitudeX = "0";
         loc.LongitudeY = "0";
         db.Locations.Add(loc);
         db.SaveChanges();
         return ResultInfo.GenerateOKResult("Saved", loc.ID);
     }
     catch
     {
         return ResultInfo.GetResultByID(1);
     }
 }