public void editSpecificationLaptop(SpecificationLaptop entity) { try { var laptop = db.Specifications.Where(x => x.catalogid == entity.id).FirstOrDefault(); var slaptop = db.SpecificationsLaptops.Where(x => x.catalogid == entity.id).FirstOrDefault(); SpecificationsMapper.laptopMapper(laptop, slaptop, entity); db.SaveChanges(); } catch (Exception) { throw new Exception("Cập nhật thông số kĩ thuật laptop lỗi"); } }
public static void laptopMapper(Specification laptop, SpecificationsLaptop slaptop, SpecificationLaptop entity) { laptop.os = entity.Specification.os; laptop.ram = entity.Specification.ram; laptop.screen = entity.Specification.screen; laptop.cpu = entity.Specification.cpu; slaptop.cardscreen = entity.SpecificationsLaptop.cardscreen; slaptop.connector = entity.SpecificationsLaptop.connector; slaptop.harddrive = entity.SpecificationsLaptop.harddrive; slaptop.design = entity.SpecificationsLaptop.design; slaptop.size = entity.SpecificationsLaptop.size; slaptop.release = entity.SpecificationsLaptop.release; }