Exemplo n.º 1
0
        public virtual ActionResult Save(CompanyModel model)
        {
            if (model == null)
            {
                return(null);
            }
            var           company = GetCompany();
            CompanyEntity entity  = null;

            if (company == null)
            {
                entity      = model.CreateEntity(SaveType.Add);
                entity.Site = new SiteEntity {
                    Id = SiteId
                };
            }
            else
            {
                entity    = model.CreateEntity(SaveType.Modify);
                entity.Id = company.Id;
            }
            var result = new Dictionary <string, object>();

            entity.Site = new SiteEntity {
                Id = SiteId
            };
            var rev  = this.SaveEntity(entity);
            var mess = rev ? "" : entity.Errors?.FirstOrDefault()?.Message;

            result.Add("Status", rev);
            result.Add("Message", mess);
            return(this.Jsonp(result));
        }