public void AddOrEditFormField(FormField formField)
 {
     if (formField.ID == default(int))
     {
         formField.Active=true;
     }
     _formFieldRepository.InsertOrUpdate(formField);
     _unitOfWork.Save();
 }
 public void InsertOrUpdate(FormField entity)
 {
     if (entity.ID == default(int)) // New entity
     {
         _context.SetAdd(entity);
     }
     else        // Existing entity
     {
         _context.SetModified(entity);
     }
 }
 public FormFieldViewModel(FormField formField)
 {
     this.ID = formField.ID;
     this.FieldName = formField.FieldName;
     this.FieldTypeId = formField.FieldTypeId;
     this.IsEditable = formField.IsEditable;
     if (formField.FieldType != null)
     {
         this.FieldTypeCode = (int)formField.FieldType.FieldTypeCode;
         this.FieldTypeName = formField.FieldType.Title;
         this.IsList =(formField.GetType()==typeof(FieldListType)?true:false);
     }
 }