Пример #1
0
        public CustomerM Delete(int id)
        {
            Customer customerDb = Context.Customers.SingleOrDefault(x => x.Id == id);

            if (customerDb == null)
            {
                return(null);
            }
            Context.Customers.Remove(customerDb);
            Context.SaveChanges();

            return(new CustomerM()
            {
                Id = customerDb.Id,
                FirstName = customerDb.FirstName,
                LastName = customerDb.LastName,
                Email = customerDb.Email,
                Address = customerDb.CustomerAddress,
                Blocked = customerDb.Blocked ?? false,
                Activated = customerDb.Activated ?? false,
                IsAdmin = customerDb.IsAdmin ?? false,
                IsRootAdmin = customerDb.IsRootAdmin ?? false,
                ShopAdminId = customerDb.ShopAdminId ?? -1,
            });
        }
        public OperativeSystemM Delete(int id)
        {
            OperativeSystem os = Context.OperativeSystems.SingleOrDefault(x => x.Id == id);

            Context.OperativeSystems.Remove(os);
            Context.SaveChanges();

            return(new OperativeSystemM()
            {
                Id = os.Id,
                OS = os.OS,
            });
        }
Пример #3
0
        public CameraM Delete(int id)
        {
            Camera cam = Context.Cameras.SingleOrDefault(x => x.Id == id);

            Context.Cameras.Remove(cam);
            Context.SaveChanges();

            return(new CameraM()
            {
                Id = cam.Id,
                MP = cam.MP,
            });
        }
Пример #4
0
        public RamM Delete(int id)
        {
            RAM ram = Context.RAMs.SingleOrDefault(x => x.Id == id);

            Context.RAMs.Remove(ram);
            Context.SaveChanges();

            return(new RamM()
            {
                Id = ram.Id,
                Memory = ram.Memory
            });
        }
Пример #5
0
        public MobileM Delete(int id)
        {
            Mobile mobile = Context.Mobiles.SingleOrDefault(x => x.Id == id);

            Context.Mobiles.Remove(mobile);
            Context.SaveChanges();

            return(new MobileM()
            {
                Id = mobile.Id,
                Name = mobile.MobileName,
                About = mobile.About,
                BatteryId = mobile.BatteryId ?? -1,
                BackCameraId = mobile.BackCameraId ?? -1,
                ExternMemoryId = mobile.ExternMemoryId ?? -1,
                InternMemoryId = mobile.InternMemoryId ?? -1,
                FrontCameraId = mobile.FrontCameraId ?? -1,
                OsId = mobile.OsId ?? -1,
                Proccessor = mobile.Proccessor,
                RamId = mobile.RamId ?? -1,
                AdditionalDescription = mobile.AdditionalDescription,
                BackCameraChar = mobile.BackCameraChar,
                Bluetooth = mobile.Bluetooth,
                DataTransfer = mobile.DataTransfer,
                Dimensions = mobile.Dimensions,
                DualSIM = mobile.DualSIM ?? false,
                FMRadio = mobile.FMRadio ?? false,
                FrontCameraChar = mobile.FrontCameraChar,
                GPS = mobile.GPS ?? false,
                HDVoice = mobile.HDVoice ?? false,
                Network2G = mobile.Network2G,
                Network3G = mobile.Network3G,
                Network4G = mobile.Network4G,
                NFC = mobile.NFC ?? false,
                PackageContent = mobile.PackageContent,
                PhoneMessages = mobile.PhoneMessages,
                PhoneWeight = mobile.PhoneWeight,
                Port35mm = mobile.Port35mm ?? false,
                Resolution = mobile.Resolution,
                ScreenSize = mobile.Size,
                ScreenType = mobile.ScreenType,
                SIM = mobile.SIM,
                Touch = mobile.Touch ?? false,
                USB = mobile.USB,
                Video = mobile.Video,
                WiFi = mobile.WiFi,
            });
        }
Пример #6
0
        public ShopMobilesM Delete(int id)
        {
            Shop_Mobiles shopMobiles = Context.Shop_Mobiles.SingleOrDefault(x => x.Id == id);

            Context.Shop_Mobiles.Remove(shopMobiles);
            Context.SaveChanges();

            return(new ShopMobilesM()
            {
                Id = shopMobiles.Id,
                MobileId = shopMobiles.MobileId ?? -1,
                MobilesLeft = shopMobiles.MobilesLeft ?? 0,
                ShopId = shopMobiles.ShopId ?? -1,
                Price = shopMobiles.Price ?? 0,
            });
        }
Пример #7
0
        public MemoryM Delete(int id)
        {
            Memory memoryDb = Context.Memories.SingleOrDefault(x => x.Id == id);

            if (memoryDb == null)
            {
                return(null);
            }
            Context.Memories.Remove(memoryDb);
            Context.SaveChanges();

            return(new MemoryM()
            {
                Id = memoryDb.Id,
                Size = memoryDb.Size,
            });
        }
Пример #8
0
        public BatteryM Delete(int id)
        {
            Battery batt = Context.Batteries.SingleOrDefault(x => x.Id == id);

            if (batt == null)
            {
                return(null);
            }

            Context.Batteries.Remove(batt);
            Context.SaveChanges();

            return(new BatteryM()
            {
                Id = batt.Id,
                Capacity = batt.Capacity
            });
        }
Пример #9
0
        public ShoppingM Delete(int id)
        {
            Shopping shopping = Context.Shoppings.SingleOrDefault(x => x.Id == id);

            Context.Shoppings.Remove(shopping);
            Context.SaveChanges();

            return(new ShoppingM()
            {
                Id = shopping.Id,
                CustomerId = shopping.CustomerId ?? -1,
                MobileId = shopping.MobileId ?? -1,
                Price = shopping.Price ?? 0,
                ShopId = shopping.ShopId ?? -1,
                Status = shopping.ShoppingStatus,
                Date = shopping.PurchasingDate ?? DateTime.Now,
            });
        }
Пример #10
0
        public ImagesM Delete(int id)
        {
            Image img = Context.Images.SingleOrDefault(x => x.Id == id);

            if (img == null)
            {
                return(null);
            }

            Context.Images.Remove(img);
            Context.SaveChanges();

            return(new ImagesM()
            {
                Id = img.Id,
                ImageBinary = img.ImageBinary,
                MobileId = img.MobileId ?? -1,
            });
        }
Пример #11
0
        public ShopM Delete(int id)
        {
            Shop shop = Context.Shops.SingleOrDefault(x => x.Id == id);

            if (shop == null)
            {
                return(null);
            }

            Context.Shops.Remove(shop);
            Context.SaveChanges();

            return(new ShopM()
            {
                Id = shop.Id,
                ContactAddress = shop.ContactAddress,
                ContactMobilePhone = shop.ContactMobilePhone,
                ContactPhone = shop.ContactPhone,
                HirePayment = shop.HirePayment ?? false,
                OpenTime = shop.OpenTime,
                ShopName = shop.ShopName,
            });
        }