Ejemplo n.º 1
0
        public ActionResult New(TrademarkViewModel model)
        {
            try
            {
                var command = new TrademarkCommand()
                {
                    ParentId         = model.ParentId,
                    Name             = model.Name,
                    Code             = model.Code,
                    ERPCode          = model.ERPCode,
                    ShortDescription = model.ShortDescription,
                    LongDescription  = model.LongDescription,
                    Status           = model.Status,
                    Environment      = this.Environment,
                    UserToken        = this.UserToken,
                    SessionId        = this.SessionId
                };

                var response = _metadataServiceClient.CreateTrademark(command);

                model.TrademarkId = response.TrademarkId;
            }
            catch (Exception e)
            {
                Log(LogMode.Error, "There is an error while creating a trademark!", e);
                throw;
            }

            return(RedirectToAction("Details", new { id = model.TrademarkId }));
        }
Ejemplo n.º 2
0
        private TrademarkViewModel CreateSelectLists(TrademarkViewModel model)
        {
            var parentTrademarks = _metadataServiceClient.GetTrademarks(new TrademarkQuery()).Result;
            var categoryStatus   = new Dictionary <Headstone.Framework.Models.EntityStatus, string>
            {
                { Headstone.Framework.Models.EntityStatus.Active, "Aktif" },
                { Headstone.Framework.Models.EntityStatus.Passive, "Pasif" }
            };
            var parentSelectList = parentTrademarks.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.TrademarkId.ToString()
            }).ToList();

            parentSelectList.Add(new SelectListItem()
            {
                Text     = "Hiçbiri",
                Value    = "",
                Selected = true
            });

            model.ParentList = parentSelectList;
            model.Statuses   = new SelectList(categoryStatus.Select(x => new { Value = x.Key, Text = x.Value }), "Value", "Text");

            return(model);
        }
Ejemplo n.º 3
0
        public ActionResult New()
        {
            var model = new TrademarkViewModel();

            model = this.CreateSelectLists(model);

            #region [ Breadcrumb ]

            // Create the breadcrumb
            var breadcrumb = new List <BreadcrumbItemViewModel>();
            breadcrumb.Add(new BreadcrumbItemViewModel()
            {
                Text = "Markalar",
                Link = "/trademarks"
            });

            breadcrumb.Add(new BreadcrumbItemViewModel()
            {
                Text = "Yeni"
            });

            ViewBag.Breadcrumb = breadcrumb;

            #endregion

            return(View(model));
        }
Ejemplo n.º 4
0
        public ActionResult Details(TrademarkViewModel model)
        {
            try
            {
                var command = new TrademarkCommand()
                {
                    TrademarkId      = model.TrademarkId,
                    ParentId         = model.ParentId,
                    Name             = model.Name,
                    Code             = model.Code,
                    ERPCode          = model.ERPCode,
                    ShortDescription = model.ShortDescription,
                    LongDescription  = model.LongDescription,
                    SortOrder        = model.SortOrder,
                    Status           = model.Status,
                    Environment      = this.Environment,
                    UserToken        = this.UserToken,
                    SessionId        = this.SessionId
                };

                var response = _metadataServiceClient.UpdateTrademark(command);
            }
            catch (Exception e)
            {
                Log(LogMode.Error, $"There is an error while updating the trademark details! TrademarkId:{model.TrademarkId}", e);

                return(RedirectToAction("Details", new { id = model.TrademarkId }));
            }

            #region [ Breadcrumb ]

            // Create the breadcrumb
            var breadcrumb = new List <BreadcrumbItemViewModel>();
            breadcrumb.Add(new BreadcrumbItemViewModel()
            {
                Text = "Markalar",
                Link = "/trademarks"
            });

            breadcrumb.Add(new BreadcrumbItemViewModel()
            {
                Text = model.Name
            });

            ViewBag.Breadcrumb = breadcrumb;

            #endregion

            return(RedirectToAction("Details", new { id = model.TrademarkId }));
        }
        public IActionResult Trademark(int id, int?pageSize, string sortBy, int page = 1)
        {
            var trademark = new TrademarkViewModel();

            ViewData["BodyClass"] = "";
            if (pageSize == null)
            {
                pageSize = _configuration.GetValue <int>("PageSize");
            }

            trademark.PageSize  = pageSize;
            trademark.SortType  = sortBy;
            trademark.Data      = _productService.GetAllPaging(id, string.Empty, page, pageSize.Value);
            trademark.Trademark = _productTrademarkService.GetById(id);

            return(View(trademark));
        }