Пример #1
0
        bool ILocation.Delete(DO.Location location)
        {
            var _success = true;

            using (var context = new LocationContext())
            {
                try
                {
                    context.Location.Remove(location);
                    context.SaveChanges();
                }
                catch (Exception ex)
                {
                    _success = false;
                    Console.WriteLine(ex.Message);
                }
            }

            return(_success);
        }
Пример #2
0
        bool ILocation.Insert(DO.Location location)
        {
            var _success = true;

            using (var context = new LocationContext())
            {
                try
                {
                    //Need to see if this insert adds duplicates to related foreignkey tables like locationtypemaster
                    //If so, then use context.entry mode to add location
                    context.Location.Add(location);
                    context.SaveChanges();
                }
                catch (Exception ex)
                {
                    _success = false;
                    Console.WriteLine(ex.Message);
                }
            }

            return(_success);
        }