public void editSpecificationMobile(SpecificationMobile entity) { try { var mobile = db.Specifications.Where(x => x.catalogid == entity.id).FirstOrDefault(); var smobile = db.SpecificationsMobiles.Where(x => x.catalogid == entity.id).FirstOrDefault(); SpecificationsMapper.mobileMapper(mobile, smobile, entity); db.SaveChanges(); } catch (Exception) { throw new Exception("Cập nhật thông số kĩ thuật điện thoại lỗi"); } }
public static void mobileMapper(Specification mobile, SpecificationsMobile smobile, SpecificationMobile entity) { mobile.os = entity.Specification.os; mobile.ram = entity.Specification.ram; mobile.screen = entity.Specification.screen; mobile.cpu = entity.Specification.cpu; smobile.internalmemory = entity.SpecificationsMobile.internalmemory; smobile.memorystick = entity.SpecificationsMobile.memorystick; smobile.sim = entity.SpecificationsMobile.sim; smobile.batery = entity.SpecificationsMobile.batery; smobile.backcamera = entity.SpecificationsMobile.backcamera; smobile.frontcamera = entity.SpecificationsMobile.frontcamera; }