public ActionResult Create(StationeryDTO stationeryDto) //Create in MVC architecture
        {
            if (ModelState.IsValid)
            {
                //This is to check if supplier are unique
                var theList = new List <string>
                {
                    stationeryDto.SupplierName1,
                    stationeryDto.SupplierName2,
                    stationeryDto.SupplierName3
                };
                var isUnique = theList.Distinct().Count() == theList.Count();
                if (isUnique == false)
                {
                    ViewBag.DistinctError      = "Please select different suppliers";
                    stationeryDto.CategoryList = _categoryRepo.GetCategories();
                    stationeryDto.SupplierList = _supplierRepo.GetSupplierList();
                    return(View(stationeryDto));
                }

                var selectedCategory = _categoryRepo.GetById(stationeryDto.CategoryId);
                var initial          = selectedCategory.CategoryName.Substring(0, 1);
                var number           = _stationeryRepo.GetLastRunningPlusOne(initial).ToString();
                var generatedItemNum = initial + number.PadLeft(3, '0');
                var st = new Stationery
                {
                    ItemNum       = generatedItemNum,
                    CategoryId    = stationeryDto.CategoryId,
                    Description   = stationeryDto.Description,
                    ReorderLevel  = stationeryDto.ReorderLevel,
                    ReorderQty    = stationeryDto.ReorderQty,
                    AverageCost   = 0,
                    UnitOfMeasure = stationeryDto.UnitOfMeasure,
                    CurrentQty    = 0,
                    BinNum        = stationeryDto.BinNum,
                    AvailableQty  = 0
                };
                _stationeryRepo.Add(st);

                var sp1 = new StationerySupplier
                {
                    ItemNum    = generatedItemNum,
                    SupplierId = int.Parse(stationeryDto.SupplierName1),
                    Price      = stationeryDto.Price1,
                    Rank       = 1
                };
                _stationerySupplierRepo.Add(sp1);


                var sp2 = new StationerySupplier
                {
                    ItemNum    = generatedItemNum,
                    SupplierId = int.Parse(stationeryDto.SupplierName2),
                    Price      = stationeryDto.Price2,
                    Rank       = 2
                };
                _stationerySupplierRepo.Add(sp2);

                var sp3 = new StationerySupplier
                {
                    ItemNum    = generatedItemNum,
                    SupplierId = int.Parse(stationeryDto.SupplierName3),
                    Price      = stationeryDto.Price3,
                    Rank       = 3
                };
                _stationerySupplierRepo.Add(sp3);
                return(RedirectToAction("Index"));
            }

            stationeryDto.CategoryList = _categoryRepo.GetCategories();
            stationeryDto.SupplierList = _supplierRepo.GetSupplierList();
            return(View(stationeryDto));
        }