Example #1
0
        public HttpResponseMessage DeleteTranslateInterpretExperience(TranslateInterpretExperienceModel model)
        {
            IUnitOfWork uWork = new UnitOfWork();
            ITranslateInterpretExperienceRepository translateInterpretExperience        = new TranslateInterpretExperienceRepository(uWork);
            ITranslateInterpretExperienceService    translateInterpretExperienceService = new TranslateInterpretExperienceService(translateInterpretExperience);

            try
            {
                if (this.ModelState.IsValid)
                {
                    var result = translateInterpretExperienceService.DeleteTranslateInterpretExperience(model);
                    if (result != null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, result));
                    }
                    else
                    {
                        string message = "Not deleted successfully";
                        return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
            }
        }
Example #2
0
        public HttpResponseMessage GetTranslateInterpretExperienceModels(BaseViewModel model)
        {
            IUnitOfWork uWork = new UnitOfWork();
            ITranslateInterpretExperienceRepository translateInterpretExperience        = new TranslateInterpretExperienceRepository(uWork);
            ITranslateInterpretExperienceService    translateInterpretExperienceService = new TranslateInterpretExperienceService(translateInterpretExperience);

            try
            {
                if (this.ModelState.IsValid)
                {
                    var TranslateInterpretExperienceList = translateInterpretExperienceService.GetAllTranslateInterpretExperienceList(model);
                    if (TranslateInterpretExperienceList != null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, TranslateInterpretExperienceList));
                    }
                    else
                    {
                        string message = "Error in getting Data";
                        return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message));
            }
        }