Exemple #1
0
        public ActionResult <Employee> GetEmployeeByEmail(string email)
        {
            var emailAddress       = fs(C4.createEmailAddress(email));
            var requestIfGoodEmail = emailAddress
                                     .Map(email =>
                                          fs(C4.getEmployeeFromDatabase(_db, email))
                                          .Map(e => (ActionResult <Employee>)Ok(e))
                                          .IfNone(() => NotFound()))
                                     .IfNone(() =>
                                             BadRequest("Invalid email address"));

            return(requestIfGoodEmail);
        }