Пример #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 }));
        }
Пример #2
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 }));
        }