/// <summary> /// single item insert/update with entity input /// </summary> /// <param name="input">to-be-insert/updated instance of entity class</param> public async Task <Elmah.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionElmahUser> Upsert(Elmah.DataSourceEntities.ElmahUser input) { //log.Info(string.Format("{0}: Update", Framework.Models.LoggingOptions.Data_Access_Layer_Process_Started.ToString())); var _retval = new Elmah.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionElmahUser(); _retval.OriginalValue = new List <Elmah.DataSourceEntities.ElmahUser>(); _retval.OriginalValue.Add(input); if (input != null) { var _LinqItem = await GetLinqObjectByIdentifier(input); if (_LinqItem == null) { _LinqItem = input.GetAClone <Elmah.EntityFrameworkContext.ElmahUser>(); LinqContext.ElmahUser.Add(_LinqItem); } else { input.CopyTo <Elmah.EntityFrameworkContext.ElmahUser>(_LinqItem); } await this.LinqContext.SaveChangesAsync(); Elmah.DataSourceEntities.ElmahUser _Result = new Elmah.DataSourceEntities.ElmahUser(); _Result.CopyFrom <Elmah.EntityFrameworkContext.ElmahUser>(_LinqItem); _retval.Result = new List <Elmah.DataSourceEntities.ElmahUser>(); _retval.Result.Add(_Result); } //log.Info(string.Format("{0}: Update", Framework.Models.LoggingOptions.Data_Access_Layer_Process_Started.ToString())); return(_retval); }
/// <summary> /// single item deletion with entity input /// </summary> /// <param name="input">item to be deleted</param> public async Task <Elmah.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionElmahUser> Delete(Elmah.DataSourceEntities.ElmahUser input) { //log.Info(string.Format("{0}: Delete", Framework.Models.LoggingOptions.Data_Access_Layer_Process_Started.ToString())); Elmah.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionElmahUser _retval = new Elmah.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionElmahUser(); _retval.OriginalValue = new List <Elmah.DataSourceEntities.ElmahUser>(); _retval.OriginalValue.Add(input); if (input != null) { Elmah.EntityFrameworkContext.ElmahUser _LinqItem = await GetLinqObjectByIdentifier(input); if (_LinqItem != null) { this.LinqContext.ElmahUser.Remove(_LinqItem); await this.LinqContext.SaveChangesAsync(); } } //log.Info(string.Format("{0}: Delete", Framework.Models.LoggingOptions.Data_Access_Layer_Process_Ended.ToString())); return(_retval); }
/// <summary> /// Gets the collection of entity of EntityByIdentifier . /// </summary> /// <param name="request">The request.</param> /// <returns>an instance of Elmah.CommonBLLEntities.ElmahUserResponseMessageBuiltIn if any</returns> public async Task <Elmah.CommonBLLEntities.ElmahUserResponseMessageBuiltIn> GetCollectionOfEntityByIdentifier( Elmah.CommonBLLEntities.ElmahUserRequestMessageUserDefinedOfIdentifier request) { //log.Info(string.Format("{0}: GetCollectionOfEntityByIdentifier", Framework.Models.LoggingOptions.Business_Logic_Layer_Process_Started.ToString())); if (!request.Criteria.CanQueryWhenNoQuery && !request.Criteria.HasQuery) { var failedResponse = new Elmah.CommonBLLEntities.ElmahUserResponseMessageBuiltIn(); failedResponse.BusinessLogicLayerResponseStatus = Framework.Services.BusinessLogicLayerResponseStatus.NeedAtLeastOneSearchCondition; failedResponse.ServerErrorMessage = "Please enter at least one search condition"; return(failedResponse); } Elmah.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionElmahUser _resultFromDAL = await this.DALClassInstance.GetCollectionOfEntityByIdentifier( request.Criteria.Identifier.User , request.QueryPagingSetting.CurrentIndex , request.QueryPagingSetting.PageSize , request.QueryOrderBySettingCollection ); Elmah.CommonBLLEntities.ElmahUserResponseMessageBuiltIn _retval = new Elmah.CommonBLLEntities.ElmahUserResponseMessageBuiltIn(); _retval.BusinessLogicLayerRequestID = request.BusinessLogicLayerRequestID; //Framework.Services.BusinessLogicLayerResponseMessageBaseHelper.MapDataAccessLayerMessageToBusinessLogicLayerResponseMessage<List<Elmah.DataSourceEntities.ElmahUser>>(_resultFromDAL, _retval); if (request.DataServiceType == Framework.Models.DataServiceTypes.DataSourceResult) { Framework.Services.BusinessLogicLayerResponseMessageBaseHelper.MapDataAccessLayerMessageToBusinessLogicLayerResponseMessage <List <Elmah.DataSourceEntities.ElmahUser> >(_resultFromDAL, _retval); } else { Framework.Services.BusinessLogicLayerResponseMessageBaseHelper.MapDataAccessLayerMessageToBusinessLogicLayerResponseMessage <Elmah.DataSourceEntities.ElmahUser, List <Elmah.DataSourceEntities.ElmahUser> >(_resultFromDAL, _retval, request.DataServiceType, new Elmah.CoreCommonBLL.ElmahUserDataStreamService()); } //log.Info(string.Format("{0}: GetCollectionOfEntityByIdentifier", Framework.Models.LoggingOptions.Business_Logic_Layer_Process_Ended.ToString())); return(_retval); }