示例#1
0
        public virtual ActionResult Modify(CustomerModel model)
        {
            if (model == null || Staff == null)
            {
                return(null);
            }
            var dataEntity = this.GetEntity <CustomerEntity>(model.Id.Convert <long>());

            if (dataEntity == null || dataEntity.Staff == null || Staff.Id != dataEntity.Staff.Id)
            {
                return(null);
            }
            var entity = model.CreateEntity(SaveType.Modify);
            var result = new Dictionary <string, object>();
            var rev    = this.SaveEntity(entity);
            var mess   = rev ? "" : entity.Errors?.FirstOrDefault()?.Message;

            result.Add("Status", rev);
            result.Add("Message", mess);
            return(this.Jsonp(result));
        }
示例#2
0
        public virtual ActionResult Add(CustomerModel model)
        {
            if (model == null)
            {
                return(null);
            }
            var entity = model.CreateEntity(SaveType.Add);
            var result = new Dictionary <string, object>();

            entity.Crm = new CrmEntity {
                Id = CrmId
            };
            entity.Staff = new StaffEntity {
                Id = Staff == null ? 0 : Staff.Id
            };
            var rev  = this.SaveEntity(entity);
            var mess = rev ? "" : entity.Errors?.FirstOrDefault()?.Message;

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