public ActionResult AddParts(AddPartViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.PictureFileName = $"{DateTime.Now.ToString("yyyymmddhhmiss")}{ model.PictureInfo.FileName}";

                    _partService.AddParts(model);

                    var folderPath = Path.Combine(_hostingEnvironment.WebRootPath, "Uploads");
                    if (model.PictureInfo.Length > 0)
                    {
                        var filePath = Path.Combine(folderPath, model.PictureFileName);
                        using (var fileStream = new FileStream(filePath, FileMode.Create))
                        {
                            model.PictureInfo.CopyToAsync(fileStream);
                        }
                    }

                    TempData.Put("Message", new NotificationViewModel()
                    {
                        Message = $"Part '{model.PartName}' added succesfully.", MessageType = NotificationType.success
                    });
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.PageMode = "Add";

                    ModelState.AddModelError("", "There are errors, please  correct them to continue!");
                    model = LoadData();
                    return(View("AddParts", model));
                }
            }
            catch (Exception ex)
            {
                TempData.Put("Message", new NotificationViewModel()
                {
                    Message = ex.ToString(), MessageType = NotificationType.error
                });
                return(View("AddParts", model));
            }
        }