Example #1
0
        protected Guid CreateForm(string name, string idcode,Guid clientId)
        {
            var form = _context.Forms.FirstOrDefault(s => s.IdCode == idcode);
              if (form == null)
              {
              form = new DformEntity
                         {
                             Id = Guid.NewGuid(),
                         };
              _context.Forms.Add(form);
              }
              form.ClientId = clientId;
              form.Name = name;
              form.IdCode = idcode;

              _context.SaveChanges();
              return form.Id;
        }
Example #2
0
        public void SaveForm(DformEntity entity)
        {
            var form = _context.Forms.FirstOrDefault(s => s.Id == entity.Id);
            if (form == null)
            {
                form = new DformEntity
                {
                    Id = Guid.NewGuid(),
                };
                _context.Forms.Add(form);
            }
            form.ClientId = entity.ClientId;
            form.Name = entity.Name;
            form.IdCode = entity.IdCode;

            _context.SaveChanges();
        }
Example #3
0
        private FormDTO Map(DformEntity s)
        {
            return new FormDTO
            {
                Id = s.Id,
                IsActive =true,
                Name = s.Name,
                Code = s.IdCode,
                ClientId = s.ClientId,
                ClientName = s.Client.Name,

            };
        }
Example #4
0
 public void Save(FormDTO dto)
 {
     var entity= new DformEntity();
     entity.Id = dto.Id;
     entity.ClientId = dto.ClientId;
     entity.IdCode = dto.Code;
     entity.Name = dto.Name;
     _formRepository.SaveForm(entity);
 }