public Entity.ActionStatus Manage(Entity.KitVerifyRequest hardwareKit, bool isEdit = false) { Entity.ActionStatus actionStatus = new Entity.ActionStatus(true); try { var verifyResult = _hardwareKitRepository.VerifyHardwareKit(hardwareKit, isEdit); if (verifyResult.Success) { actionStatus = _hardwareKitRepository.SaveHardwareKit(hardwareKit, isEdit); } else { List <Entity.BulkUploadResponse> errorResult = verifyResult.Data; actionStatus.Data = errorResult; // verifyResult.Data; actionStatus.Success = verifyResult.Success; actionStatus.Message = verifyResult.Message; // "H/W Kit ID / Unique ID already exists"; } } catch (Exception ex) { _logger.ErrorLog(ex, this.GetType().Name, MethodBase.GetCurrentMethod().Name); actionStatus.Success = false; actionStatus.Message = ex.Message; } return(actionStatus); }
public Entity.ActionStatus Manage(Entity.KitVerifyRequest hardwareKit, bool isEdit = false) { Entity.ActionStatus actionStatus = new Entity.ActionStatus(true); try { //foreach (var kit in hardwareKit.HardwareKits) //{ // if (string.IsNullOrWhiteSpace(kit.Tag)) continue; // var tagGuid = Guid.Parse(kit.Tag); // var kitAttribute = _kitTypeAttributeRepository.FindBy(t => t.Guid.Equals(tagGuid)).FirstOrDefault(); // if (kitAttribute != null) // { // kit.Tag = kitAttribute.Tag; // kit.AttributeName = kitAttribute.LocalName; // } //} var verifyResult = _hardwareKitRepository.VerifyHardwareKit(hardwareKit, isEdit); if (verifyResult.Success) { actionStatus = _hardwareKitRepository.SaveHardwareKit(hardwareKit, isEdit); } else { List <Entity.BulkUploadResponse> errorResult = verifyResult.Data; //if (errorResult != null) //{ // foreach (var error in errorResult) // { // if (string.IsNullOrWhiteSpace(error.tag)) continue; // var tag = error.tag; // var kitAttribute = _kitTypeAttributeRepository.FindBy(t => t.Tag.Equals(error.tag) && t.LocalName.Equals(error.attributename)).FirstOrDefault(); // if (kitAttribute != null) // { // error.tag = kitAttribute.Guid.ToString(); // } // } //} actionStatus.Data = errorResult; // verifyResult.Data; actionStatus.Success = verifyResult.Success; actionStatus.Message = verifyResult.Message; // "H/W Kit ID / Unique ID already exists"; } } catch (Exception ex) { _logger.ErrorLog(ex, this.GetType().Name, MethodBase.GetCurrentMethod().Name); actionStatus.Success = false; actionStatus.Message = ex.Message; } return(actionStatus); }