Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Core Data iOS Essentials

You're reading from  Core Data iOS Essentials

Product type Book
Published in Apr 2011
Publisher Packt
ISBN-13 9781849690942
Pages 340 pages
Edition 1st Edition
Languages

Table of Contents (19) Chapters

Core Data iOS Essentials
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Overview 2. Understanding Core Data 3. Understanding Objective-C Protocol and Table View 4. Designing a Data Model and Building Data Objects for Customers 5. Creating, Listing, and Deleting Names of Customers 6. Creating, Listing, Displaying, and Deleting Records of Customers 7. Updating and Searching Records of Customers 8. Entering, Saving, Listing, and Deleting the Records of the Products Sold to the Customers 9. Entering, Displaying, and Deleting the Stock 10. Editing the Stock Information 11. Displaying the Products for Sale and Updating the Stock Appendix

Updating the stock


The implementation file of the AddProductController class (AddProductController.m) is modified to save the information of the product sold to the selected customer. Not only will the implementation file save the information of the product sold but, will also update the stock; the quantity of the product sold will be reduced from the inventory, that is, from the stock maintained in the MasterProduct entity. For example, if the initial quantity of Milk is 100 bottles (in the MasterProduct entity) and three bottles are sold to the customer, the quantity of the product left in the MasterProduct entity will be 97 bottles. Only the statements that are highlighted are added to the file and rest of the code is same as we saw in Chapter 8, Entering, Saving, Listing, and Deleting the Records of the Products Sold to the Customers:

// AddProductController.m
// prob
#import "AddProductController.h"
@implementation AddProductController
@synthesize newitemname, newquantity, newprice...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}